featureModel layer from earth file vs featureModel layer defined programmatically...

classic Classic list List threaded Threaded
2 messages Options
2LR 2LR
Reply | Threaded
Open this post in threaded view
|

featureModel layer from earth file vs featureModel layer defined programmatically...

I have two featureModel layers that I'm displaying in my program. The first one is defined in my earth file as follows:

  <OGRFeatures name="virginiaData">
    <url>../data/virginia.shp</url>
  </OGRFeatures>

  <FeatureModel name="Virginia" features="virginiaData">
    <styles>
      <style> state { stroke: #ffff00; stroke-width: 4px; altitude-clamping: terrain-drape; } </style>    </styles>
  </FeatureModel>


The second featureModelLayer is defined programmatically as follows:

OGRFeatureSource* features = new OGRFeatureSource();
features->setName("utahData");
features->setURL("../data/utah.shp");

FeatureModelLayer* layer = new FeatureModelLayer();
layer->setFeatureSource(features);
layer->setName("Utah");

Style style;
style.setName("state");
LineSymbol* ls = style.getOrCreateSymbol<LineSymbol>();
ls->stroke()->color() = Color::Yellow;
ls->stroke()->width() = 4.0f;
ls->tessellationSize()->set(100, Units::KILOMETERS);
AltitudeSymbol* alt = style.getOrCreateSymbol<AltitudeSymbol>();
alt->clamping() = alt->CLAMP_TO_TERRAIN;
alt->technique() = alt->TECHNIQUE_DRAPE;

StyleSheet* styleSheet = new StyleSheet();
styleSheet->addStyle(style);
layer->setStyleSheet(styleSheet);

map->addLayer(layer);


Both features render as you would expect. When I go to close each layer, they close as expected. When I open each layer, the layer defined in the earth file opens and renders on the screen. The layer I defined programmatically doesn't open and render at all. I'm opening and closing each layer via the Map Layers Tool in ImGui.

Debugging into the code, I noticed that the featureModel layer from the earth file calls:

bool GeomFeatureNodeFactory::createOrUpdateNode(...)

when I open the layer. The featureModel layer created in the program does not call this.

Can someone tell me what I need to do get the featureModel layer created programmatically to display when I open it back up like the featureModel layer defined in the earth file?

Both feature layers are open via the ImGui map Layers tool...


Both feature layers are closed...


Both feature layers are opened again. The "Virginia" feature layer defined in the earth file opens and displays. The "Utah" feature layer defined programmatically doesn't display after being opened.


Any help would be appreciated...
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: featureModel layer from earth file vs featureModel layer defined programmatically...

Hi,
If you can attach a self-contained cpp we can use to demonstrate the problem, we will take a look. Probably best to post as a new GitHub issue if you think there's a bug. Thanks.
Glenn Waldron / Pelican Mapping