static public void Text(ref XmlTextWriter xWriter, xyPoint p, string text, double size, double angle, string col, double offset) { if (angle < 0) { angle += 360.0; } double o = (angle) / 180.0 * Math.PI; p.x -= Math.Sin(o) * offset; p.y += Math.Cos(o) * offset; xWriter.WriteStartElement("TEXT"); xWriter.WriteAttributeString("coords", p.x.ToString() + " " + p.y.ToString()); xWriter.WriteAttributeString("label", text); xWriter.WriteStartElement("TEXTMARKERSYMBOL"); xWriter.WriteAttributeString("angle", angle.ToString()); // nicht beim ArcMAP Service xWriter.WriteAttributeString("antialiasing", "true"); xWriter.WriteAttributeString("fontsize", size.ToString()); xWriter.WriteAttributeString("font", "Arial"); xWriter.WriteAttributeString("fontcolor", col); xWriter.WriteAttributeString(/*"blockout"*/ "outline", "255,255,255"); xWriter.WriteEndElement(); // TEXTMARKERSYMBOL xWriter.WriteEndElement(); // TEXT }
static public void createMeasureAXL(ref XmlTextWriter xWriter, xyPoint p1, xyPoint p2, double scale) { double sf = scale / 1000.0; openObject(ref xWriter); LineSymbol(ref xWriter, 3.0, "255,255,255"); Line(ref xWriter, p1, p2); closeObject(ref xWriter); openObject(ref xWriter); LineSymbol(ref xWriter, 1.0, "0,0,0"); Line(ref xWriter, p1, p2); closeObject(ref xWriter); double al = Math.Atan2(p2.y - p1.y, p2.x - p1.x); if (al < 0.0) { al += 2.0 * Math.PI; } xyPoint pp1 = new xyPoint(p1.x + Math.Cos(al + 0.5) * 2 * sf, p1.y + Math.Sin(al + 0.5) * 2 * sf); xyPoint pp2 = new xyPoint(p1.x + Math.Cos(al - 0.5) * 2 * sf, p1.y + Math.Sin(al - 0.5) * 2 * sf); openObject(ref xWriter); LineSymbol(ref xWriter, 3.0, "255,255,255"); Line(ref xWriter, pp1, p1, pp2); closeObject(ref xWriter); openObject(ref xWriter); LineSymbol(ref xWriter, 1.0, "0,0,0"); Line(ref xWriter, pp1, p1, pp2); closeObject(ref xWriter); pp1.x = p2.x + Math.Cos(al + 0.5 + Math.PI) * 2 * sf; pp1.y = p2.y + Math.Sin(al + 0.5 + Math.PI) * 2 * sf; pp2.x = p2.x + Math.Cos(al - 0.5 + Math.PI) * 2 * sf; pp2.y = p2.y + Math.Sin(al - 0.5 + Math.PI) * 2 * sf; openObject(ref xWriter); LineSymbol(ref xWriter, 3.0, "255,255,255"); Line(ref xWriter, pp1, p2, pp2); closeObject(ref xWriter); openObject(ref xWriter); LineSymbol(ref xWriter, 1.0, "0,0,0"); Line(ref xWriter, pp1, p2, pp2); closeObject(ref xWriter); double len = Math.Round(Math.Sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y)), 2), sign = 1.0; string text = String.Format("{0:0.00}", len) /*+" m"*/; double al_text = al; if (al > 0.5 * Math.PI && al < 1.5 * Math.PI) { al_text -= Math.PI; sign = -1.0; } pp1.x = p1.x + Math.Cos(al) * (len / 2.0 - (text.Length / 2) * 2 * sf * sign); pp1.y = p1.y + Math.Sin(al) * (len / 2.0 - (text.Length / 2) * 2 * sf * sign); openObject(ref xWriter); Text(ref xWriter, pp1, text, 12.0, al_text * 180.0 / Math.PI, "0,0,0", 1.0 * sf); closeObject(ref xWriter); }
public void createAXL(ref XmlTextWriter xml) { if (!isValid) { return; } switch (GeometryType) { case geometryType.Envelope: xyPoint p1 = (xyPoint)m_points[0], p2 = (xyPoint)m_points[1]; double minx = Math.Min(p1.x, p2.x), miny = Math.Min(p1.y, p2.y), maxx = Math.Max(p1.x, p2.x), maxy = Math.Max(p1.y, p2.y); xml.WriteStartElement("ENVELOPE"); xml.WriteAttributeString("minx", minx.ToString()); xml.WriteAttributeString("miny", miny.ToString()); xml.WriteAttributeString("maxx", maxx.ToString()); xml.WriteAttributeString("maxy", maxy.ToString()); xml.WriteEndElement(); // Enveolpe break; case geometryType.Point: if (m_bufferDist > 1e-7) { createBufferAXL(ref xml); } xml.WriteStartElement("MULTIPOINT"); foreach (xyPoint p in m_points) { axlShapes.Point(ref xml, p); } xml.WriteEndElement(); // MULTIPOINT break; case geometryType.Polyline: if (m_bufferDist > 1e-7) { createBufferAXL(ref xml); } xml.WriteStartElement("POLYLINE"); xml.WriteStartElement("PATH"); foreach (xyPoint p in m_points) { axlShapes.Point(ref xml, p); } xml.WriteEndElement(); // PATH xml.WriteEndElement(); // POLYLINE break; case geometryType.Polygon: if (m_bufferDist > 1e-7) { createBufferAXL(ref xml); } xml.WriteStartElement("POLYGON"); xml.WriteStartElement("RING"); foreach (xyPoint p in m_points) { axlShapes.Point(ref xml, p); } xml.WriteEndElement(); // RING xml.WriteEndElement(); // POLYGON break; case geometryType.Unknown: if (m_bufferDist > 1e-7) { createBufferAXL(ref xml); } xml.WriteRaw(m_axl); break; } }
public xyPoint(xyPoint p) { x = p.x; y = p.y; }
public void addPoint(xyPoint point) { m_points.Add(point); }