/** * Converts a geometry::box into a SpatialIndex::Region * @param b The region (box) to convert * @return The converted region */ static SpatialIndex::Region convert_region_2d(const boost::geometry::model::box<point_type>& b) { point_type ll = b.min_corner(); point_type ur = b.max_corner(); SpatialIndex::Region r(convert_point(ll),convert_point(ur)); r.makeDimension(m_dimension); return r; }
/** * Converts a SpatialIndex::LineSegment into an geometry::linestring * @param l The line to convert * @return The converted line */ static boost::geometry::model::linestring<point_type > convert_line_segment(const SpatialIndex::LineSegment l) { if(l.getDimension() != m_dimension) { throw Tools::IllegalArgumentException("Line dimension does not match converter dimension"); } point_type p; point_type start_p = convert_point(SpatialIndex::Point(l.m_pStartPoint,m_dimension)); point_type end_p = convert_point(SpatialIndex::Point(l.m_pEndPoint,m_dimension)); boost::geometry::model::linestring<point_type > line; boost::geometry::append(line,start_p); boost::geometry::append(line, end_p); return line; }
void one_point::operator() (m2::PointD const & pt) { ASSERT ( !m_exist, ("point feature should have only one point") ); if (m_rect->IsPointInside(pt)) { m_exist = true; m_point = convert_point(pt); } else m_exist = false; }
double convert(double value, length_unit_t unit_from, length_unit_t unit_to) { switch (unit_from) { case length_unit_point: return convert_point(value, unit_to); case length_unit_inch: return convert_inch(value, unit_to); case length_unit_centimeter: return convert_centimeter(value, unit_to); case length_unit_xlsx_column_digit: return convert_xlsx_column_digit(value, unit_to); default: ; } throw general_error("convert: unsupported unit of measurement."); }
mapnik::geometry::geometry<double> ogr_converter::convert_geometry(OGRGeometry* ogr_geom) { // NOTE: wkbFlatten macro in ogr flattens 2.5d types into base 2d type switch (wkbFlatten(ogr_geom->getGeometryType())) { case wkbPoint: return convert_point(static_cast<OGRPoint*>(ogr_geom)); break; case wkbMultiPoint: return convert_multipoint(static_cast<OGRMultiPoint*>(ogr_geom)); break; case wkbLinearRing: return convert_linestring(static_cast<OGRLinearRing*>(ogr_geom)); break; case wkbLineString: return convert_linestring(static_cast<OGRLineString*>(ogr_geom)); break; case wkbMultiLineString: return convert_multilinestring(static_cast<OGRMultiLineString*>(ogr_geom)); break; case wkbPolygon: return convert_polygon(static_cast<OGRPolygon*>(ogr_geom)); break; case wkbMultiPolygon: return convert_multipolygon(static_cast<OGRMultiPolygon*>(ogr_geom)); break; case wkbGeometryCollection: return convert_collection(static_cast<OGRGeometryCollection*>(ogr_geom)); break; case wkbNone: case wkbUnknown: default: { MAPNIK_LOG_WARN(ogr) << "ogr_converter: unknown <ogr> geometry_type=" << wkbFlatten(ogr_geom->getGeometryType()); } return mapnik::geometry::geometry<double>(); break; } }
// // handles the callback from the dime-library // bool dxfConverter::private_callback(const dimeState * const state, dimeEntity *entity) { if (entity->typeId() == dimeBase::dimePolylineType) { this->currentPolyline = entity; } if (state->getCurrentInsert()) { this->currentInsertColorIndex = getColorIndex((dimeEntity*)state->getCurrentInsert()); } else { this->currentInsertColorIndex = 7; } dxfLayerData *ld = getLayerData(entity); // fillmode on by default. entities which will not fill its polygons // should turn it off (layerData::addQuad() will create polygons, // not lines) // ld->setFillmode(true); switch (entity->typeId()) { case dimeBase::dime3DFaceType: convert_3dface(entity, state, ld, this); break; case dimeBase::dimeSolidType: convert_solid(entity, state, ld, this); break; case dimeBase::dimeTraceType: convert_solid(entity, state, ld, this); break; case dimeBase::dimeArcType: convert_arc(entity, state, ld, this); break; case dimeBase::dimeCircleType: convert_circle(entity, state, ld, this); break; case dimeBase::dimeEllipseType: convert_ellipse(entity, state, ld, this); break; case dimeBase::dimeInsertType: // handled in traverseEntities break; case dimeBase::dimeBlockType: // handled in traverseEntities break; case dimeBase::dimeLineType: convert_line(entity, state, ld, this); break; case dimeBase::dimeLWPolylineType: convert_lwpolyline(entity, state, ld, this); break; case dimeBase::dimePointType: convert_point(entity, state, ld, this); break; case dimeBase::dimePolylineType: convert_polyline(entity, state, ld, this); break; case dimeBase::dimeSplineType: // go for it Raphael! :-) break; default: break; } return true; }