public override void RenderOsmObject( MapMakerSettings mapMakerSettings, MapDataAnalysis analysis, InMemoryOsmDatabase osmDatabase, OsmObjectBase osmObject, OsmRelation parentRelation, CGpsMapperMapWriter mapWriter) { mapWriter.AddSection("POLYGON") .AddTypeReference(TypeRegistration) .AddCoordinates( "Data", analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MaxLevel], GetNodesForWay(osmDatabase, (OsmWay)osmObject)); // rendering of holes if (osmObject is OsmAreaWithHoles) { OsmAreaWithHoles areaWithHoles = (OsmAreaWithHoles)osmObject; foreach (int holeWayId in areaWithHoles.EnumerateHolesWaysIds()) { OsmWay holeWay = osmDatabase.GetWay(holeWayId); if (holeWay.NodesCount > 3) { mapWriter.AddCoordinates( "Data", analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MaxLevel], GetNodesForWay(osmDatabase, holeWay)); } } } mapWriter .Add("EndLevel", analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MinLevel]) ; if (this.TypeRegistration.Label != null && false == this.TypeRegistration.Label.IsConstant) { mapWriter.Add("Label", this.TypeRegistration.Label.BuildLabel(mapMakerSettings, osmObject, parentRelation)); } }
public override void RenderOsmObject( MapMakerSettings mapMakerSettings, MapDataAnalysis analysis, InMemoryOsmDatabase osmDatabase, OsmObjectBase osmObject, OsmRelation parentRelation, CGpsMapperMapWriter mapWriter) { mapWriter.AddSection("POI") .AddTypeReference(TypeRegistration); // find the location to put the icon on OsmNode iconNode = null; if (osmObject is OsmNode) { iconNode = (OsmNode)osmObject; } else if (osmObject is OsmWay) { PointD2 location = Brejc.OsmLibrary.Helpers.OsmGeometryUtils.FindAreaCenterPoint( (OsmWay)osmObject, osmDatabase); iconNode = new OsmNode(1, location.X, location.Y); } else { throw new InvalidOperationException("Internal error."); } mapWriter .AddCoordinates("Data", analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MaxLevel], iconNode) .Add("EndLevel", analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MinLevel]) ; if (this.TypeRegistration.Label != null && false == this.TypeRegistration.Label.IsConstant) { mapWriter.Add("Label", this.TypeRegistration.Label.BuildLabel(mapMakerSettings, osmObject, parentRelation)); } }