Exemplo n.º 1
0
        public void RenderPolygon(
            MapMakerSettings mapMakerSettings,
            MapDataAnalysis analysis,
            IPointD2List polygonPoints,
            CGpsMapperMapWriter mapWriter)
        {
            mapWriter.AddSection("POLYGON")
            .AddTypeReference(TypeRegistration)
            .AddCoordinates(
                "Data",
                analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MaxLevel],
                polygonPoints);

            mapWriter
            .Add("EndLevel", analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MinLevel])
            ;
        }
Exemplo n.º 2
0
        public void RenderContour(
            IPointD2List contourPoints,
            double contourElevation,
            MapDataAnalysis analysis,
            CGpsMapperMapWriter mapWriter)
        {
            mapWriter.AddSection("POLYLINE")
            .AddTypeReference(TypeRegistration)
            .AddCoordinates(
                "Data",
                analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MaxLevel],
                contourPoints)
            .Add("EndLevel", analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MinLevel]);

            if (showElevation)
            {
                mapWriter.Add("Label", (int)contourElevation);
            }
        }
Exemplo n.º 3
0
        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));
            }
        }
Exemplo n.º 4
0
        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));
            }
        }
Exemplo n.º 5
0
        public override void RenderOsmObject(
            MapMakerSettings mapMakerSettings,
            MapDataAnalysis analysis,
            InMemoryOsmDatabase osmDatabase,
            OsmObjectBase osmObject,
            OsmRelation parentRelation,
            CGpsMapperMapWriter mapWriter)
        {
            mapWriter.AddSection("POLYLINE")
            .AddTypeReference(TypeRegistration)
            .AddCoordinates(
                "Data",
                analysis.HardwareToLogicalLevelDictionary[TypeRegistration.MaxLevel],
                GetNodesForWay(osmDatabase, (OsmWay)osmObject))
            .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).ToUpperInvariant());
            }
        }