当前位置: 首页>>代码示例>>C++>>正文


C++ GeometryFactory类代码示例

本文整理汇总了C++中GeometryFactory的典型用法代码示例。如果您正苦于以下问题:C++ GeometryFactory类的具体用法?C++ GeometryFactory怎么用?C++ GeometryFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GeometryFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getPositionAttitudeTransform

void
EllipseNode::rebuild()
{
    osgEarth::clearChildren( getPositionAttitudeTransform() );

    // construct a local-origin ellipse.
    GeometryFactory factory;
    Geometry* geom = NULL;

    if (std::abs(_arcEnd.as(Units::DEGREES) - _arcStart.as(Units::DEGREES)) >= 360.0)
    {
        geom = factory.createEllipse(osg::Vec3d(0,0,0), _radiusMajor, _radiusMinor, _rotationAngle, _numSegments);
    }
    else
    {
        geom = factory.createEllipticalArc(osg::Vec3d(0,0,0), _radiusMajor, _radiusMinor, _rotationAngle, _arcStart, _arcEnd, _numSegments, 0L, _pie);
    }
    if ( geom )
    {
        GeometryCompiler compiler;
        osg::ref_ptr<Feature> feature = new Feature(geom, 0L); //todo: consider the SRS
        osg::ref_ptr<osg::Node> node = compiler.compile( feature.get(), _style, FilterContext(0L) );
        if ( node )
        {
            node = AnnotationUtils::installOverlayParent(node.get(), _style);
            getPositionAttitudeTransform()->addChild( node.get() );
        }

        applyRenderSymbology( _style );
        setLightingIfNotSet( false );

    }
}
开发者ID:falconlulu,项目名称:osgearth,代码行数:33,代码来源:EllipseNode.cpp

示例2: getDecoration

void
CircleNode::rebuild()
{
    std::string currentDecoration = getDecoration();
    clearDecoration();

    //Remove all children from this node
    //removeChildren( 0, getNumChildren() );
    if ( getRoot()->getNumParents() == 0 )
    {
        this->addChild( getRoot() );
    }

    //Remove all children from the attach point
    getChildAttachPoint()->removeChildren( 0, getChildAttachPoint()->getNumChildren() );

    // construct a local-origin circle.
    GeometryFactory factory;
    Geometry* geom = factory.createCircle(osg::Vec3d(0,0,0), _radius, _numSegments);
    if ( geom )
    {
        GeometryCompiler compiler;
        osg::ref_ptr<Feature> feature = new Feature(geom, 0L); //todo: consider the SRS
        osg::Node* node = compiler.compile( feature.get(), _style, FilterContext(0L) );
        if ( node )
        {           
            getChildAttachPoint()->addChild( node );
            getDrapeable()->setDraped( _draped );
        }

        applyStyle( _style );
    }

    setDecoration( currentDecoration );
}
开发者ID:ender35,项目名称:osgearth,代码行数:35,代码来源:CircleNode.cpp

示例3: getDecoration

void
RectangleNode::rebuild()
{    
    std::string currentDecoration = getDecoration();
    clearDecoration();

    // Reset:
    osgEarth::clearChildren( this );
    osgEarth::clearChildren( _xform.get() );
    this->addChild( _xform.get() );

    // construct a local-origin circle.
    GeometryFactory factory;    
    Geometry* geom = factory.createRectangle(osg::Vec3d(0,0,0), _width, _height);
    if ( geom )
    {
        GeometryCompiler compiler;
        osg::ref_ptr<Feature> feature = new Feature(geom, 0L); //todo: consider the SRS
        osg::Node* node = compiler.compile( feature.get(), _style, FilterContext(0L) );
        if ( node )
        {
            _xform->addChild( node );
            replaceChild( _xform.get(), applyAltitudePolicy(_xform.get(), _style) );
        }

        applyRenderSymbology( _style );
        setLightingIfNotSet( false );
    }

    setDecoration( currentDecoration );
}
开发者ID:omega-hub,项目名称:osgearth,代码行数:31,代码来源:RectangleNode.cpp

示例4: newFactory

/* private */
auto_ptr<GeometryFactory>
GeometryPrecisionReducer::createFactory( const GeometryFactory& oldGF,
                                         const PrecisionModel& newPM )
{
  auto_ptr<GeometryFactory> newFactory(
    new GeometryFactory(&newPM,
                        oldGF.getSRID(),
                        const_cast<CoordinateSequenceFactory*>(oldGF.getCoordinateSequenceFactory()))
  );
  return newFactory;
}
开发者ID:52North,项目名称:IlwisCore,代码行数:12,代码来源:GeometryPrecisionReducer.cpp

示例5: augeGetGeometryFactoryInstance

	Geometry* FeatureShp::CreateGeometry(long index, SHPHandle pSHPHandle)
	{
		if(pSHPHandle==NULL)
		{
			return NULL;
		}

		int	  iWKBLen = 0;
		g_uchar* pWKB = NULL;
		Geometry*	pGeometry  = NULL;
		SHPObject*	pSHPObject = NULL;
		GeometryFactory* pGeometryFactory = augeGetGeometryFactoryInstance();

		pSHPObject = ::SHPReadObject(pSHPHandle, index);
		if(pSHPObject==NULL)
		{
			return NULL;
		}

		iWKBLen = ShpUtil::GetWKBLength(pSHPObject);
		if(iWKBLen==0)
		{
			::SHPDestroyObject(pSHPObject);
			return NULL;
		}

		pWKB = (g_uchar*)auge_malloc(iWKBLen,sizeof(g_uchar));
		if(pWKB==NULL)
		{
			::SHPDestroyObject(pSHPObject);
			return NULL;
		}
		memset(pWKB, 0, iWKBLen);
		if(ShpUtil::SHPObject_2_WKB(pSHPObject, pWKB, iWKBLen)==0)
		{
			delete[] pWKB;
			::SHPDestroyObject(pSHPObject);
			return NULL;
		}

		pGeometry = pGeometryFactory->CreateGeometryFromWKB(pWKB, true);

		if(pGeometry==NULL)
		{
			delete[] pWKB;
		}

		::SHPDestroyObject(pSHPObject);

		return pGeometry;
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:51,代码来源:FeatureShp.cpp

示例6: GeometryFactory

void GeometryFactory::New(const FunctionCallbackInfo<Value>& args) {
    GeometryFactory* factory;
    if (args.Length() == 0) {
        factory = new GeometryFactory();
    } else if (args.Length() == 1) {
        PrecisionModel* model = ObjectWrap::Unwrap<PrecisionModel>(args[0]->ToObject());
        factory = new GeometryFactory(model->_model);
    } else {
        PrecisionModel* model = ObjectWrap::Unwrap<PrecisionModel>(args[0]->ToObject());
        int newSRID = args[1]->IntegerValue();
        factory = new GeometryFactory(model->_model, newSRID);
    }
    factory->Wrap(args.This());
    args.GetReturnValue().Set(args.This());
}
开发者ID:kashif,项目名称:node-geos,代码行数:15,代码来源:geometryfactory.cpp

示例7: GeometryFactory

Handle<Value> GeometryFactory::New(const Arguments& args) {
    HandleScope scope;
    GeometryFactory* factory;
    if (args.Length() == 0) {
        factory = new GeometryFactory();
    } else if (args.Length() == 1) {
        PrecisionModel* model = ObjectWrap::Unwrap<PrecisionModel>(args[0]->ToObject());
        factory = new GeometryFactory(model->_model);
    } else {
        PrecisionModel* model = ObjectWrap::Unwrap<PrecisionModel>(args[0]->ToObject());
        int newSRID = args[1]->IntegerValue();
        factory = new GeometryFactory(model->_model, newSRID);
    }
    factory->Wrap(args.This());
    return args.This();
}
开发者ID:agate,项目名称:node-geos,代码行数:16,代码来源:geometryfactory.cpp

示例8: strdup

char *get_wkt_simple(osmNode *nodes, int count, int polygon) {
    GeometryFactory gf;
    std::auto_ptr<CoordinateSequence> coords(gf.getCoordinateSequenceFactory()->create((size_t)0, (size_t)2));

    try
    {
        for (int i = 0; i < count ; i++) {
            Coordinate c;
            c.x = nodes[i].lon;
            c.y = nodes[i].lat;
            coords->add(c, 0);
        }

        geom_ptr geom;
        if (polygon && (coords->getSize() >= 4) && (coords->getAt(coords->getSize() - 1).equals2D(coords->getAt(0)))) {
            std::auto_ptr<LinearRing> shell(gf.createLinearRing(coords.release()));
            geom = geom_ptr(gf.createPolygon(shell.release(), new std::vector<Geometry *>));
            if (!geom->isValid()) {
                if (excludepoly) {
                    return NULL;
                } else {   
                    geom = geom_ptr(geom->buffer(0));
                }
            }
            geom->normalize(); // Fix direction of ring
        } else {
            if (coords->getSize() < 2)
                return NULL;
            geom = geom_ptr(gf.createLineString(coords.release()));
        }

        WKTWriter wktw;
        std::string wkt = wktw.write(geom.get());
        return strdup(wkt.c_str());
    }
    catch (std::bad_alloc)
    {
        std::cerr << std::endl << "Exception caught processing way. You are likelly running out of memory." << std::endl;
        std::cerr << "Try in slim mode, using -s parameter." << std::endl;
        return NULL;
    }
    catch (...)
    {
        std::cerr << std::endl << "Exception caught processing way" << std::endl;
        return NULL;
    }
}
开发者ID:ajashton,项目名称:osm2pgsql,代码行数:47,代码来源:build_geometry.cpp

示例9: CoordinateArraySequence

/* public */
std::auto_ptr<LineString>
LineSegment::toGeometry(const GeometryFactory& gf) const
{
	CoordinateSequence *cl=new CoordinateArraySequence();
	cl->add(p0);
	cl->add(p1);
	return std::auto_ptr<LineString>(
		gf.createLineString(cl) // ownership transferred
	);
}
开发者ID:AvlWx2014,项目名称:basemap,代码行数:11,代码来源:LineSegment.cpp

示例10: getDecoration

void
EllipseNode::rebuild()
{
    std::string currentDecoration = getDecoration();
    clearDecoration();

    //Remove all children from this node
    removeChildren( 0, getNumChildren() );

    //Remove all children from the attach point
    getAttachPoint()->removeChildren( 0, getAttachPoint()->getNumChildren() );

    // construct a local-origin ellipse.
    GeometryFactory factory;
    Geometry* geom = factory.createEllipse(osg::Vec3d(0,0,0), _radiusMajor, _radiusMinor, _rotationAngle, _numSegments);
    if ( geom )
    {
        GeometryCompiler compiler;
        osg::ref_ptr<Feature> feature = new Feature(geom, 0L); //todo: consider the SRS
        osg::Node* node = compiler.compile( feature.get(), _style, FilterContext(0L) );
        if ( node )
        {
            getAttachPoint()->addChild( node );

            if ( _draped )
            {
                DrapeableNode* drapeable = new DrapeableNode( _mapNode.get() );
                drapeable->addChild( getAttachPoint() );
                this->addChild( drapeable );
            }

            else
            {
                this->addChild( getAttachPoint() );
            }
        }

        applyStyle( _style, _draped );
    }

    setDecoration( currentDecoration );
}
开发者ID:airwzz999,项目名称:osgearth-for-android,代码行数:42,代码来源:EllipseNode.cpp

示例11: setGeometry

void
EllipseNode::rebuildGeometry()
{
    // construct a local-origin ellipse.
    GeometryFactory factory;

    osg::ref_ptr<Geometry> geom;

    if (std::abs(_arcEnd.as(Units::DEGREES) - _arcStart.as(Units::DEGREES)) >= 360.0)
    {
        geom = factory.createEllipse(osg::Vec3d(0,0,0), _radiusMajor, _radiusMinor, _rotationAngle, _numSegments);
    }
    else
    {
        geom = factory.createEllipticalArc(osg::Vec3d(0,0,0), _radiusMajor, _radiusMinor, _rotationAngle, _arcStart, _arcEnd, _numSegments, 0L, _pie);
    }
    if ( geom.valid() )
    {
        setGeometry( geom.get() );
    }
}
开发者ID:XenonofArcticus,项目名称:osgearth,代码行数:21,代码来源:EllipseNode.cpp

示例12: getDecoration

void
EllipseNode::rebuild()
{
    std::string currentDecoration = getDecoration();
    clearDecoration();

    //Remove all children from this node
    osgEarth::clearChildren( this );
    osgEarth::clearChildren( _xform.get() );
    this->addChild( _xform.get() );

    // construct a local-origin ellipse.
    GeometryFactory factory;
    Geometry* geom = NULL;

    if (std::abs(_arcEnd.as(Units::DEGREES) - _arcStart.as(Units::DEGREES)) >= 360.0)
    {
        geom = factory.createEllipse(osg::Vec3d(0,0,0), _radiusMajor, _radiusMinor, _rotationAngle, _numSegments);
    }
    else
    {
        geom = factory.createEllipticalArc(osg::Vec3d(0,0,0), _radiusMajor, _radiusMinor, _rotationAngle, _arcStart, _arcEnd, _numSegments, 0L, _pie);
    }
    if ( geom )
    {
        GeometryCompiler compiler;
        osg::ref_ptr<Feature> feature = new Feature(geom, 0L); //todo: consider the SRS
        osg::Node* node = compiler.compile( feature.get(), _style, FilterContext(0L) );
        if ( node )
        {
            _xform->addChild( node );
            this->replaceChild( _xform.get(), applyAltitudePolicy(_xform.get(), _style) );
        }

        applyRenderSymbology( _style );
        setLightingIfNotSet( false );
    }

    setDecoration( currentDecoration );
}
开发者ID:omega-hub,项目名称:osgearth,代码行数:40,代码来源:EllipseNode.cpp

示例13: getPositionAttitudeTransform

void
RectangleNode::rebuild()
{    
    osgEarth::clearChildren( getPositionAttitudeTransform() );

    // construct a local-origin circle.
    GeometryFactory factory;    
    Geometry* geom = factory.createRectangle(osg::Vec3d(0,0,0), _width, _height);
    if ( geom )
    {
        GeometryCompiler compiler;
        osg::ref_ptr<osg::Node> node = compiler.compile( geom, _style, FilterContext() );
        if ( node )
        {
            node = AnnotationUtils::installOverlayParent( node.get(), _style );
            getPositionAttitudeTransform()->addChild( node.get() );
        }

        applyRenderSymbology( _style );
        setLightingIfNotSet( false );
    }
}
开发者ID:XenonofArcticus,项目名称:osgearth,代码行数:22,代码来源:RectangleNode.cpp

示例14: switch

	GValue* TransactionHandler::CreateValue(XNode* pxNode, GField* pField)
	{
		GValue* pValue = NULL;
		const char* str= NULL;
		switch(pField->GetType())
		{					 
		case augeFieldTypeShort:
			{
				str = pxNode->GetContent();
				pValue = new GValue((short)atoi(str));
			}
			break;
		case augeFieldTypeInt:
			{
				str = pxNode->GetContent();
				pValue = new GValue((int)atoi(str));
			}
			break;
		case augeFieldTypeLong:
			{
				str = pxNode->GetContent();
				pValue = new GValue((long)atoi(str));
			}
			break;
		case augeFieldTypeInt64:
			{
				str = pxNode->GetContent();
				pValue = new GValue((int64)atoi(str));
			}
			break;
		case augeFieldTypeFloat:
			{
				str = pxNode->GetContent();
				pValue = new GValue((float)atof(str));
			}
			break;
		case augeFieldTypeDouble:
			{
				str = pxNode->GetContent();
				pValue = new GValue((double)atof(str));
			}
			break;
		case augeFieldTypeChar:			 
			{
				str = pxNode->GetContent();
				pValue = new GValue(str[0]);
			}
			break;
		case augeFieldTypeString:
			{
				pValue = new GValue(pxNode->GetContent());
			}
			break;
		case augeFieldTypeTime:	
			{
				str = pxNode->GetContent();
				if(str!=NULL)
				{
					TIME_STRU tim;
					memset(&tim,0, sizeof(TIME_STRU));
					sscanf(str,"%d-%2d-%2d %2d:%2d:%2d",&(tim.usYear),&(tim.usMonth),&(tim.usDay),&(tim.usHour),&(tim.usMinute),&(tim.usSecond));
					pValue = new GValue(&tim,true);
				}
			}
			break;
		case augeFieldTypeBool:			 
			{

			}
			break;
		case augeFieldTypeBLOB:			 
			{

			}
			break;
		case augeFieldTypeGeometry:
			{
				XNode* pxGeometry = pxNode->GetFirstChild();
				if(pxGeometry==NULL)
				{
					const char* msg = "Geometry Node is NULL";
					augeGetLoggerInstance()->Error(msg,__FILE__,__LINE__);		
				}
				else
				{
					Geometry* pGeometry = NULL;
					GeometryFactory* factory = augeGetGeometryFactoryInstance();
					GMLReader* reader = factory->CreateGMLReader();
					pGeometry = reader->Read(static_cast<XElement*>(pxGeometry));
					reader->Release();

					if(pGeometry==NULL)
					{
						const char* msg = "Invalid Geometry";
						augeGetLoggerInstance()->Error(msg,__FILE__,__LINE__);	
						const char* text = pxGeometry->ToString();
						augeGetLoggerInstance()->Error(text,__FILE__,__LINE__);	
					}
					else
					{
//.........这里部分代码省略.........
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:101,代码来源:TransactionHandler.cpp

示例15: catch

    void GeoWaveWriter::write(const PointViewPtr view)
    {

        using namespace Dimension;

        std::ostringstream os;

        BasicAccumuloOperations accumuloOperations;
        try
        {
            accumuloOperations = java_new<BasicAccumuloOperations>(
                java_new<String>(m_zookeeperUrl),
                java_new<String>(m_instanceName),
                java_new<String>(m_username),
                java_new<String>(m_password),
                java_new<String>(m_tableNamespace));
        }
        catch (AccumuloException& e)
        {
            log()->get(LogLevel::Error) << "There was a problem establishing a connector. " << e;
            return;
        }
        catch (AccumuloSecurityException& e)
        {
            log()->get(LogLevel::Error) << "The credentials passed are invalid. " << e;
            return;
        }

        AccumuloDataStore accumuloDataStore = java_new<AccumuloDataStore>(
            accumuloOperations);

        Index index = IndexType_JaceIndexType::createSpatialVectorIndex();

        AccumuloIndexWriter accumuloIndexWriter = java_new<AccumuloIndexWriter>(
            index,
            accumuloOperations,
            accumuloDataStore);

        // treat all types as double
        os << "location:Point:srid=4326";
        for (auto di = m_dims.begin(); di != m_dims.end(); ++di)
            os << "," << view->dimName(*di) << ":Double";

        SimpleFeatureType TYPE = DataUtilities::createType(
            java_new<String>(m_featureTypeName),
            java_new<String>(os.str()));

        String location = java_new<String>("location");

        WritableDataAdapter dataAdapter;
        if (m_useFeatCollDataAdapter)
            dataAdapter = java_new<FeatureCollectionDataAdapter>(
            TYPE,
            m_pointsPerEntry);
        else
            dataAdapter = java_new<FeatureDataAdapter>(TYPE);


        GeometryFactory geometryFactory = JTSFactoryFinder::getGeometryFactory();
        SimpleFeatureBuilder builder = java_new<SimpleFeatureBuilder>(TYPE);

        DefaultFeatureCollection featureCollection = java_new<DefaultFeatureCollection>(
            UUID::randomUUID().toString(),
            TYPE);

        for (PointId idx = 0; idx < view->size(); ++idx)
        {
            JDouble X = view->getFieldAs<double>(Id::X, idx);
            JDouble Y = view->getFieldAs<double>(Id::Y, idx);

            Point point = geometryFactory.createPoint(
                java_new<Coordinate>(
                X,
                Y));

            builder.set(location, point);

            for (auto di = m_dims.begin(); di != m_dims.end(); ++di)
                if (view->hasDim(*di))
                    builder.set(java_new<String>(view->dimName(*di)), java_new<Double>(view->getFieldAs<double>(*di, idx)));

            SimpleFeature feature = builder.buildFeature(UUID::randomUUID().toString());

            if (m_useFeatCollDataAdapter)
                featureCollection.add(feature);
            else
                accumuloIndexWriter.write(
                dataAdapter,
                feature);
        }

        if (m_useFeatCollDataAdapter)
            accumuloIndexWriter.write(
            dataAdapter,
            featureCollection);

        accumuloIndexWriter.close();
    }
开发者ID:PDAL,项目名称:PDAL,代码行数:98,代码来源:GeoWaveWriter.cpp


注:本文中的GeometryFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。