[geos-devel] cannot convert ‘geos::geom::LineString*’ to ‘geos::geom::Geometry*’ in assignment

Debabrata Bardhan dbardhan at gmail.com
Thu Mar 17 07:49:18 EDT 2011


Hello,

I have a class as  following . As i have notice Class LineString is derived
from Geometry Class but when I am trying assing LineSegment  object
reference to a Geometry pointer , I am getting an error like

*cannot convert ‘geos::geom::LineString*’ to ‘geos::geom::Geometry*’ in
assignment*

Can you please help me in this regard.

class Position : public SimplePointInAreaLocator  //SimplePointInAreaLocator
is class in algorithm/locator
{
private:
    Geometry *_geom;
public:

    Position(Geometry *g):SimplePointInAreaLocator(g),_geom(g)
    {}

    Position(LineSegment ls):SimplePointInAreaLocator(NULL),_geom(NULL){
        GeometryFactory *_factory;
        CoordinateSequence *cl = new CoordinateArraySequence();
        cl->add(ls.p0);
        cl->add(ls.p1);
        _geom = _factory->createLineString(cl);  //AT THIS LINE I AM GETTING
ERROR


    }
    void setGeometry(Geometry *g){_geom = g;}

    bool calculate(const Coordinate &p){
        return locate(p,_geom);
    }


};



Thanks & Regards,
Debabrata Bardhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geos-devel/attachments/20110317/a306d2cd/attachment.html


More information about the geos-devel mailing list