Why do I draw the road without image?

classic Classic list List threaded Threaded
3 messages Options
diabear diabear
Reply | Threaded
Open this post in threaded view
|

Why do I draw the road without image?

I run the sample "roads.earth" which can see the road image, but when i translate this to the code, only can see a white line, no image. Where is the problem?

Earth File segment:
    <model driver="feature_geom" min_level="13">
        <cache_policy usage="none"/>
        <features name="roads" driver="ogr">
          <url>../Roads/2.shp</url>
            <build_spatial_index>true</build_spatial_index>
        </features>
        <layout tile_size="2000">
            <level class="default" max_range="10000"/>
        </layout>
        <styles>
            <style type="text/css"> default { stroke: #ffffff; stroke-width: 25m; stroke-tessellation-size: 50m; stroke-image: "../data/road.png"; altitude-clamping: terrain; altitude-resolution: 0.00001; altitude-binding: vertex; render-order: 1; render-transparent: true; render-decal: true; altitude-offset: 0.05; } </style>        </styles>
    </model>

Code segment:
        OGRFeatureOptions sOGROpts;
        sOGROpts.name() = g_strRoadStyleName;
        sOGROpts.url() = strFoundFilename;
        sOGROpts.buildSpatialIndex() = true;

        Style sStyle(g_strRoadStyleName);

        LineSymbol* pLine = sStyle.getOrCreate<LineSymbol>();
        pLine->stroke()->color() = Color::White;
        pLine->stroke()->width() = 25;
        pLine->tessellationSize() = 50;
        pLine->imageURI() = "d:/road.png";       // ??????? no image ???????

        AltitudeSymbol* pAlt = sStyle.getOrCreate<AltitudeSymbol>();
        pAlt->clamping() = pAlt->CLAMP_TO_TERRAIN;
        pAlt->binding() = pAlt->BINDING_VERTEX;
        pAlt->clampingResolution() = 0.00001f;
        pAlt->verticalOffset() = 0.05f;

        RenderSymbol* pRender = sStyle.getOrCreate<RenderSymbol>();
        pRender->order() = 1;
        pRender->transparent() = true;
        pRender->decal() = true;

        StyleSheet* pStyleSheet = new StyleSheet();
        pStyleSheet->addStyle(sStyle);

        FeatureDisplayLayout sLayout;
        sLayout.tileSizeFactor() = 2000;
        sLayout.addLevel(FeatureLevel(0.0f, 10000, g_strRoadStyleName));

        FeatureGeomModelOptions sFGMOpts;
        sFGMOpts.featureOptions() = sOGROpts;
        sFGMOpts.styles() = pStyleSheet;
        sFGMOpts.layout() = sLayout;

        ModelLayerOptions sLayerOpts(g_strRoadMODName + sData.strName);
        sLayerOpts.cachePolicy() = CachePolicy::USAGE_NO_CACHE;
        sLayerOpts.driver() = sFGMOpts;
        sLayerOpts.maskMinLevel() = 13;
        m_pKernelData->pMap->addModelLayer(new ModelLayer(sLayerOpts));
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Why do I draw the road without image?

diabear,
Please register for the forum and tell us your name :)

You probably need to set your stroke widthUnits to meters.
Glenn Waldron / Pelican Mapping
diabear diabear
Reply | Threaded
Open this post in threaded view
|

Re: Why do I draw the road without image?

The problem has been solved, thank you very much!

PS: I have registered account :)