Exemple #1
0
        public override void DrawLine(GravurGIS.Styles.StylePen pen, int x1, int y1, int x2, int y2)
        {
            StyleColor color = pen.BackgroundBrush.Color;

            _graphics.DrawLine(new Pen(Color.FromArgb(color.R, color.G, color.B), pen.Width),
                x1, y1, x2, y2);
        }
Exemple #2
0
        public override bool Render(GravurGIS.Rendering.RenderProperties rp)
        {
            IntPtr hDC = rp.G.GetHdc();
            MapPanelBindings.OGRDrawImage(container, hDC, rp.Scale, rp.DX / rp.Scale, rp.DY / rp.Scale, layerID);
            rp.G.ReleaseHdc(hDC);

            return true;
        }
Exemple #3
0
        public OGRLayer(GravurGIS.MapPanelBindings.VectorLayerInfo info, IntPtr container)
        {
            this.Description = "OGR Layer";
            this._layerType = LayerType.OGRLayer;
            this.Visible = true;
            this.Changed = true;

            this.layerID = info.id;
            this.container = container;

            this._boundingBox = new GravurGIS.Topology.WorldBoundingBoxD(info.minBX,
                info.maxBY, info.maxBX, info.minBY);
        }
Exemple #4
0
        public ImageLayer(LayerManager lm, GravurGIS.MapPanelBindings.ImageLayerInfo info, string name, string path)
        {
            this.Description = "Rasterbild";
            this._layerType = LayerType.Image;
            this.Visible = true;
            this.Changed = true;

            this.layerID = info.id;

            this._boundingBox = new GravurGIS.Topology.WorldBoundingBoxD(info.minBX,
                info.maxBY, info.maxBX, info.minBY);

            this.LayerName = name;
            this.layerInfo = new LayerInfo(path + "\\" + name);
            this.layermanager = lm;
            this.resolution = new double[2];
            this.resolution[0] = info.resolutionX;
            this.resolution[1] = info.resolutionY;
        }
Exemple #5
0
 public abstract void FillRectangle(GravurGIS.Styles.SolidStyleBrush brush, int x, int y, int width, int height);
Exemple #6
0
 public override void FillRectangle(GravurGIS.Styles.StyleBrush brush, System.Drawing.Rectangle rectangle)
 {
     StyleColor color = brush.Color;
     _graphics.FillRectangle(new SolidBrush(Color.FromArgb(color.R, color.G, color.B)), rectangle);
 }
Exemple #7
0
 public override void FillPolygon(GravurGIS.Styles.StyleBrush brush, System.Drawing.Point[] points)
 {
     StyleColor color = brush.Color;
     _graphics.FillPolygon(new SolidBrush(Color.FromArgb(color.R, color.G, color.B)), points);
 }
Exemple #8
0
 public override void DrawString(string text, System.Drawing.Font font, GravurGIS.Styles.SolidStyleBrush brush, int x, int y, System.Drawing.StringFormat format)
 {
     StyleColor color = brush.Color;
     _graphics.DrawString(text, font, new SolidBrush(Color.FromArgb(color.R, color.G, color.B)), x, y);
 }
Exemple #9
0
 public override void DrawRectangle(GravurGIS.Styles.StylePen pen, System.Drawing.Rectangle rectangle)
 {
     StyleColor color = pen.BackgroundBrush.Color;
     _graphics.DrawRectangle(new Pen(Color.FromArgb(color.R, color.G, color.B), pen.Width), rectangle);
 }
Exemple #10
0
 void LayerManager_FirstLayerAdded(GravurGIS.Layers.Layer newShapeObject)
 {
     openTransportMenuItem.Enabled = true;
     importTransportMenuItem.Enabled = true;
 }
Exemple #11
0
        public void SetPosition(PointD newPosition, GravurGIS.Styles.HorizontalAlignment hv, VerticalAlignment vv)
        {
            double scale = mainControler.LayerManager.Scale;
            double invScale = 1 / scale;
            newPosition.x -= (((int)hv * 0.5 * drawingArea.Width) * invScale);
            newPosition.y += (((int)vv * 0.5 * drawingArea.Height) * invScale);

            mainControler.PerformAction(new PanAction(d * invScale, newPosition,
                scale, this, GravurGIS.CoordinateSystems.CoordinateType.World));
        }
Exemple #12
0
 public abstract void FillRectangle(GravurGIS.Styles.StyleBrush brush, System.Drawing.Rectangle rectangle);
Exemple #13
0
 public abstract void FillPolygon(GravurGIS.Styles.StyleBrush brush, System.Drawing.Point[] points);
Exemple #14
0
 public abstract void DrawString(string text, System.Drawing.Font font, GravurGIS.Styles.SolidStyleBrush brush, int x, int y, System.Drawing.StringFormat format);
Exemple #15
0
 public abstract void DrawRectangle(GravurGIS.Styles.StylePen pen, System.Drawing.Rectangle rectangle);
Exemple #16
0
 public abstract void DrawLines(GravurGIS.Styles.StylePen pen, System.Drawing.Point[] points);
Exemple #17
0
 public abstract void DrawLine(GravurGIS.Styles.StylePen pen, int x1, int y1, int x2, int y2);
Exemple #18
0
 public PointD GetPosition(GravurGIS.Styles.HorizontalAlignment hv, VerticalAlignment vv)
 {
     double scale = mainControler.LayerManager.Scale;
     return new PointD(
         (d.x + (int)hv * 0.5 * drawingArea.Width) / scale,
         (d.y - (int)vv * 0.5 * drawingArea.Height) / scale);
 }
Exemple #19
0
 public override void DrawLines(GravurGIS.Styles.StylePen pen, System.Drawing.Point[] points)
 {
     StyleColor color = pen.BackgroundBrush.Color;
     _graphics.DrawLines(new Pen(Color.FromArgb(color.R, color.G, color.B), pen.Width), points);
 }
Exemple #20
0
 void LayerManager_FirstLayerAdded(GravurGIS.Layers.Layer newShapeObject)
 {
     for (int i = 0; i < MenuItems.Count; i++)
         MenuItems[i].Enabled = true;
 }
Exemple #21
0
        public void generateGeometryStructureInDLL(ShapeObject shpObject,
            ref GravurGIS.Topology.Grid.Grid partGrid)
        {
            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();

            IntPtr cPointObjectPtr;

            if (LayerCount == 0)
                cPointObjectPtr = ShapeLib.SHPGetPolyLineList(shpObject.LayerInfo.FilePath, shpObject.Access,
                    mainControler.MapPanel.Width, mainControler.MapPanel.Height,
                    mainControler.MapPanel.Margin, 1, 1.0d, 0,pointSize, 0);
            else
                cPointObjectPtr = ShapeLib.SHPGetPolyLineList(shpObject.LayerInfo.FilePath, shpObject.Access,
                    mainControler.MapPanel.Width, mainControler.MapPanel.Height,
                    mainControler.MapPanel.Margin, 1, firstScale, 1,0, 0);

            if (cPointObjectPtr.Equals(IntPtr.Zero))
            {
                mainControler.showErrorMessage("Fehler 0x0002: Shapereferenz ist ungültig");
            }
            else
            {
                int momentaryPointCount;
                double[] xWorldList;
                double[] yWorldList;
                int[] xDispList;
                int[] yDispList;
                int pointCount = 0;

                ShapeLib.PointObject pntObj = new ShapeLib.PointObject();
                Marshal.PtrToStructure(cPointObjectPtr, pntObj);

                shpObject.BoundingBox = new WorldBoundingBoxD(pntObj.minBX,
                    pntObj.maxBY, pntObj.maxBX, pntObj.minBY);

                if (pntObj.isWellDefines == 0)
                    shpObject.IsWellDefined = false;
                else
                    shpObject.IsWellDefined = true;

                if (LayerCount == 0)
                {
                    mainControler.MapPanel.AbsolutZoom = 1;

                    if (pntObj.isPoint == 0) //normal shpObject
                    {
                        this.firstScale = this.scale = pntObj.scale;

                        mainControler.MapPanel.DX = firstScale * pntObj.minBX;
                        mainControler.MapPanel.DY = firstScale * pntObj.maxBY;
                    }
                    else //shpObject contains only 1 point
                    {
                        // 1:1 Maßstab oder lieber schon etwas rauszoomen?
                        this.scale = pntObj.scale; // ((mainControler.MapPanel.Width) - 2 * (mainControler.MapPanel.Margin) - 2) / (double)defaultShapeSize;
                        this.firstScale = this.scale;

                        shpObject.IsOnePoint = true;
                        mainControler.MapPanel.DX = firstScale * (pntObj.minBX - (int)(defaultShapeSize / 2));
                        mainControler.MapPanel.DY = firstScale * (pntObj.maxBY + (int)(defaultShapeSize / 2));
                    }
                }

                shpObject.NumberOfShapes = (uint)(pntObj.shapeCount > 0 ? pntObj.shapeCount : 0);

                shpObject.ShapeType = pntObj.shpType;
                shpObject.PartCount = (uint)(pntObj.partCount > 0 ? pntObj.partCount : 0);

                PointList[] polyLinePointList;

                // make sure we have shapes and parts
                if (pntObj.shapeCount > 0
                    && (pntObj.partCount > 0 || pntObj.shpType == ShapeLib.ShapeType.Point))
                {
                    // Create the outer list which holds the pointers to the sublists
                    xWorldList = new double[pntObj.nVertices];
                    Marshal.Copy(pntObj.worldX, xWorldList, 0, pntObj.nVertices);
                    yWorldList = new double[pntObj.nVertices];
                    Marshal.Copy(pntObj.worldY, yWorldList, 0, pntObj.nVertices);
                    xDispList = new int[pntObj.nVertices];
                    Marshal.Copy(pntObj.dispX, xDispList, 0, pntObj.nVertices);
                    yDispList = new int[pntObj.nVertices];
                    Marshal.Copy(pntObj.dispY, yDispList, 0, pntObj.nVertices);

                    // Create a new Grid
                    partGrid = new GravurGIS.Topology.Grid.Grid(25, 25,
                        Convert.ToInt32(shpObject.Width * firstScale),
                        Convert.ToInt32(shpObject.Height * firstScale), false);

                    if (pntObj.shpType != ShapeLib.ShapeType.MultiPoint
                        && pntObj.shpType != ShapeLib.ShapeType.Point)
                    {
                        // Get the list with the lengths of the sublists
                        int[] partListLengths = new int[pntObj.partCount];
                        Marshal.Copy(pntObj.partListLengths, partListLengths, 0, pntObj.partCount);

                        // Copy the sublists to a new pointList
                        polyLinePointList = new PointList[pntObj.partCount];

                        for (int i = 0; i < pntObj.partCount; i++)
                        {
                            momentaryPointCount = partListLengths[i];

                            polyLinePointList[i] = new PointList(momentaryPointCount);

                            // Copy the temporay lists into points and into the polyPointList
                            for (int j = 0; j < momentaryPointCount; j++)
                            {
                                int pos = pointCount + j;
                                polyLinePointList[i].add(xWorldList[pos],
                                    yWorldList[pos], xDispList[pos], yDispList[pos], j);
                            }
                            partGrid.insert(polyLinePointList[i], getBoundingBox(ref polyLinePointList[i]));

                            pointCount += momentaryPointCount;
                        }
                    }
                    else  //shpType == MultiPoint
                    {
                        polyLinePointList = new PointList[pntObj.shapeCount];
                        for (int i = 0; i < pntObj.shapeCount; i++)
                        {
                            polyLinePointList[i] = new PointList(1);
                            polyLinePointList[i].add(xWorldList[i], yWorldList[i], xDispList[i], yDispList[i], 0);
                            partGrid.insert(polyLinePointList[i], getBoundingBox(ref polyLinePointList[i]));
                        }

                    }

                    shpObject.PolyLinePointList = polyLinePointList;
                    //double tempAbsZoom = mainControler.MapPanel.AbsolutZoom;

                    // TODO: Warum wird das hier gemacht? Wird das wirklich gebraucht?
                    // Tom: Ich habe es erstmal auskommentiert
                    //int dispHeight = (int)(shpObject.BoundingBox.Height * scale + 0.5);
                    //for (int pointList = 0; pointList < shpObject.PartCount; pointList++)
                    //    shpObject.PolyLinePointList[pointList].recalculatePoints(scale, dispHeight, pntObj.minBX, pntObj.minBY);
                }

                shpObject.Changed = true;

                stopWatch.Stop();

                mainControler.addLogMessage(String.Format("[Shape] geladen nach {0}ms", stopWatch.ElapsedMilliseconds.ToString()));

                // clean things up
                MapTools.ShapeLib.deletePointObject(cPointObjectPtr);
            }
        }