/////////////////////////////////////////////////////////////////////////////// void VectorDataLayer::AddVectorLayer(std::string nodeName, std::string filename, float lineWidth, unsigned int lineColor) { char* strPtr; osgEarth::OGRFeatureSource *featureSrc = new osgEarth::OGRFeatureSource(); if (featureSrc != NULL) { // featureSrc->setName(nodeName); featureSrc->setURL(filename); featureSrc->setOpenAutomatically(true); mMapNode->getMap()->addLayer(featureSrc); osgEarth::Style style; osgEarth::LineSymbol* ls = style.getOrCreateSymbol(); { ls->stroke().mutable_value().color() = osgEarth::Color(lineColor); ls->stroke().mutable_value().width() = lineWidth; ls->tessellationSize() = osgEarth::Distance(100, osgEarth::Units::KILOMETERS); } osgEarth::AltitudeSymbol* alt = style.getOrCreate(); alt->clamping() = alt->CLAMP_TO_TERRAIN; alt->technique() = alt->TECHNIQUE_DRAPE; osgEarth::FeatureModelLayer* layer = new osgEarth::FeatureModelLayer(); layer->setFeatureSource(featureSrc); osgEarth::StyleSheet* styleSheet = new osgEarth::StyleSheet(); styleSheet->addStyle(style); layer->setStyleSheet(styleSheet); layer->setName(nodeName); mMapNode->getMap()->addLayer(layer); if (layer->getStatus().isError()) { OE_WARN << layer->getStatus().message() << std::endl; } } }