void FeatureConnector::storeSegment(const UPGeometry& geom, const FeatureCoverage *fcov, std::ofstream& output_file, double& raw){ geos::geom::GeometryTypeId geostype = geom->getGeometryTypeId(); if ( geostype == geos::geom::GEOS_MULTILINESTRING || geos::geom::GEOS_LINESTRING) { const geos::geom::Geometry *lines = geom.get(); if ( geostype == geos::geom::GEOS_LINESTRING ){ const geos::geom::LineString *line = dynamic_cast<const geos::geom::LineString*>(lines); if ( !line){ ERROR2(ERR_NO_INITIALIZED_2, "lines", fcov->name()); return; } writeLine(line,output_file,raw); } else { int n = (qint32)lines->getNumGeometries(); for(int i = 0; i < n ; ++i){ const geos::geom::LineString *line = dynamic_cast<const geos::geom::LineString*>(lines->getGeometryN(i)); if ( !line){ ERROR2(ERR_NO_INITIALIZED_2, "lines", fcov->name()); return; } writeLine(line,output_file,raw); } } ++raw; } }
void FeatureConnector::storePoint(const UPGeometry& geom, const FeatureCoverage *fcov, std::ofstream& output_file, double& raw){ geos::geom::GeometryTypeId geostype = geom->getGeometryTypeId(); if ( geostype == geos::geom::GEOS_MULTIPOINT ||geostype == geos::geom::GEOS_POINT) { const geos::geom::Geometry *points = geom.get(); if ( geostype == geos::geom::GEOS_POINT ){ const geos::geom::Point *point = dynamic_cast<const geos::geom::Point*>(points); if ( !point){ ERROR2(ERR_NO_INITIALIZED_2, "points", fcov->name()); return; } writePoint(point,output_file, raw); } else { int n = (int)points->getNumGeometries(); for(int i = 0; i < n ; ++i){ const geos::geom::Point* point = dynamic_cast<const geos::geom::Point*>(points->getGeometryN(i)); if ( !point){ ERROR2(ERR_NO_INITIALIZED_2, "points", fcov->name()); return; } writePoint(point,output_file, raw); } } ++raw; } }
void Polygon2Line::extractBoundary(const UPGeometry& g, quint32& record){ const geos::geom::Geometry *geom1 = g.get(); std::vector<geos::geom::CoordinateSequence *> coords = GeometryHelper::geometry2coords(geom1); geos::geom::Geometry *geometry; if ( coords.size() == 1) geometry = _outputfeatures->geomfactory()->createLineString(coords[0]); else if ( coords.size() > 1){ std::vector<geos::geom::Geometry *> lines; for(int i=0; i < coords.size(); ++i) lines.push_back(_outputfeatures->geomfactory()->createLineString(coords[i])); geometry = _outputfeatures->geomfactory()->createMultiLineString(lines); } if ( geometry){ SPFeatureI outfeature = _outputfeatures->newFeature(geometry); if (_singleId){ outfeature->setCell(0,0); }else { outfeature->setCell(0, record); } } }
VertexIterator::VertexIterator(const UPGeometry& geom) { setFromGeometry(geom.get()); }