Exemplo n.º 1
0
 private static MapLineSegment ParseSegment(string input) {
     MapLineSegment result = new MapLineSegment();
     input = input.Substring(1);//remove L from the start.
     input = input.Replace(" ", "");
     string[] tokens = input.Split(',');
     result.aX = float.Parse(tokens[0]);
     result.aY = float.Parse(tokens[1]);
     result.aZ = float.Parse(tokens[2]);
     result.bX = float.Parse(tokens[3]);
     result.bY = float.Parse(tokens[4]);
     result.bZ = float.Parse(tokens[5]);
     result.color.A = 255;
     result.color.R = byte.Parse(tokens[6]);
     result.color.G = byte.Parse(tokens[7]);
     result.color.B = byte.Parse(tokens[8]);
     return result;
 }
Exemplo n.º 2
0
        /*private void ResizeCanvasToZone(string zone) {
            if (this.zoneMap != null) {
                mapCanvas.Width = this.zoneMap.maxX - this.zoneMap.minX;
                mapCanvas.Height = this.zoneMap.maxY - this.zoneMap.minY;
            }
        }*/

        private void DrawMap(ResizeValHolder rvh) {
            foreach (MapLine line in this.zoneMap.lineList) {
                List<MapLineSegment> tmpSegmentList = new List<MapLineSegment>();
                foreach (MapLineSegment segment in line.segmentList) {
                    MapLineSegment tmpSegment = new MapLineSegment();
                    //adjust for 0 points being in the middle of the zone
                    float tmpaX = segment.aX - rvh.minX;
                    float tmpaY = segment.aY - rvh.minY;
                    float tmpbX = segment.bX - rvh.minX;
                    float tmpbY = segment.bY - rvh.minY;
                    //adjust for scale
                    tmpaX = tmpaX * rvh.resizeRatio;
                    tmpaY = tmpaY * rvh.resizeRatio;
                    tmpbX = tmpbX * rvh.resizeRatio;
                    tmpbY = tmpbY * rvh.resizeRatio;
                    //center image
                    tmpaX = tmpaX + rvh.centerDistanceX;
                    tmpaY = tmpaY + rvh.centerDistanceY;
                    tmpbX = tmpbX + rvh.centerDistanceX;
                    tmpbY = tmpbY + rvh.centerDistanceY;
                    tmpSegmentList.Add(new MapLineSegment(tmpaX, tmpaY, tmpbX, tmpbY));
                }
                //draw line
                mapVisuals.AddLine(tmpSegmentList, line.colorPen);
            }
        }