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); }
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; }
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); }
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; }
public abstract void FillRectangle(GravurGIS.Styles.SolidStyleBrush brush, int x, int y, int width, int height);
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); }
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); }
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); }
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); }
void LayerManager_FirstLayerAdded(GravurGIS.Layers.Layer newShapeObject) { openTransportMenuItem.Enabled = true; importTransportMenuItem.Enabled = true; }
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)); }
public abstract void FillRectangle(GravurGIS.Styles.StyleBrush brush, System.Drawing.Rectangle rectangle);
public abstract void FillPolygon(GravurGIS.Styles.StyleBrush brush, System.Drawing.Point[] points);
public abstract void DrawString(string text, System.Drawing.Font font, GravurGIS.Styles.SolidStyleBrush brush, int x, int y, System.Drawing.StringFormat format);
public abstract void DrawRectangle(GravurGIS.Styles.StylePen pen, System.Drawing.Rectangle rectangle);
public abstract void DrawLines(GravurGIS.Styles.StylePen pen, System.Drawing.Point[] points);
public abstract void DrawLine(GravurGIS.Styles.StylePen pen, int x1, int y1, int x2, int y2);
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); }
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); }
void LayerManager_FirstLayerAdded(GravurGIS.Layers.Layer newShapeObject) { for (int i = 0; i < MenuItems.Count; i++) MenuItems[i].Enabled = true; }
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); } }