c# WPF example of Geometry Layer
Posted: Mon May 23, 2016 9:29 am
Hi,
I need an adaption of the example in the CookBook about the use of GeometryLayer form Java to c# WPF.
The code below unfortunately doesn't show the polyline:
xserver.GeometryOption[] test_geometryOptions = new xserver.GeometryOption[] {
new xserver.GeometryOption { option = xserver.GeometryOptions.BORDERCOLOR, value = rgbToColorString(0,128,255)},
new xserver.GeometryOption { option = xserver.GeometryOptions.FILLCOLOR, value = rgbToColorString(255,0,0)},
new xserver.GeometryOption { option = xserver.GeometryOptions.FILLALPHA, value = "200"}, // 0-255
new xserver.GeometryOption { option = xserver.GeometryOptions.AUTOCENTEROBJECTS, value = "1"} // 0-255
};
xserver.PlainPoint[] test_points = new xserver.PlainPoint[] {
new xserver.PlainPoint { x = 7.06654212202759, y = 41.3049992893457 },
new xserver.PlainPoint { x = 10.7403702470276, y = 41.2521586885924 },
new xserver.PlainPoint { x = 10.7052139970276, y = 38.6520066768626 },
new xserver.PlainPoint { x = 7.52357337202759, y = 38.5970748172508 },
new xserver.PlainPoint { x = 7.57630774702759, y = 41.1728175884917 }
};
xserver.PlainLinearRing test_plainLinearRing = new xserver.PlainLinearRing();
test_plainLinearRing.wrappedPoints = test_points;
xserver.Polygon test_polygon = new xserver.Polygon();
test_polygon.polygon = new xserver.PlainPolygon();
test_polygon.polygon.wrappedLinearRings = new xserver.PlainLinearRing[] { test_plainLinearRing };
xserver.Point point = new xserver.Point { point = new xserver.PlainPoint { x = 7.06654212202759, y = 41.3049992893457 } };
xserver.Geometry test_geometry = new xserver.Geometry {
description = "test_geometry",
id = 0,
geometry = test_polygon,
referencePoint = point
};
xserver.Geometries test_geometries = new xserver.Geometries();
test_geometries.wrappedGeometries = new xserver.Geometry[] { test_geometry };
test_geometries.wrappedOptions = test_geometryOptions;
xserver.GeometryLayer layer = new xserver.GeometryLayer {
name = "test_geometry_Layer",
drawPriority = 150,
visible = true,
wrappedGeometries = new xserver.Geometries[] { test_geometries },
objectInfos = xserver.ObjectInfoType.GEOMETRY
};
thanks in advance and Kind Regards
Daniele
I need an adaption of the example in the CookBook about the use of GeometryLayer form Java to c# WPF.
The code below unfortunately doesn't show the polyline:
xserver.GeometryOption[] test_geometryOptions = new xserver.GeometryOption[] {
new xserver.GeometryOption { option = xserver.GeometryOptions.BORDERCOLOR, value = rgbToColorString(0,128,255)},
new xserver.GeometryOption { option = xserver.GeometryOptions.FILLCOLOR, value = rgbToColorString(255,0,0)},
new xserver.GeometryOption { option = xserver.GeometryOptions.FILLALPHA, value = "200"}, // 0-255
new xserver.GeometryOption { option = xserver.GeometryOptions.AUTOCENTEROBJECTS, value = "1"} // 0-255
};
xserver.PlainPoint[] test_points = new xserver.PlainPoint[] {
new xserver.PlainPoint { x = 7.06654212202759, y = 41.3049992893457 },
new xserver.PlainPoint { x = 10.7403702470276, y = 41.2521586885924 },
new xserver.PlainPoint { x = 10.7052139970276, y = 38.6520066768626 },
new xserver.PlainPoint { x = 7.52357337202759, y = 38.5970748172508 },
new xserver.PlainPoint { x = 7.57630774702759, y = 41.1728175884917 }
};
xserver.PlainLinearRing test_plainLinearRing = new xserver.PlainLinearRing();
test_plainLinearRing.wrappedPoints = test_points;
xserver.Polygon test_polygon = new xserver.Polygon();
test_polygon.polygon = new xserver.PlainPolygon();
test_polygon.polygon.wrappedLinearRings = new xserver.PlainLinearRing[] { test_plainLinearRing };
xserver.Point point = new xserver.Point { point = new xserver.PlainPoint { x = 7.06654212202759, y = 41.3049992893457 } };
xserver.Geometry test_geometry = new xserver.Geometry {
description = "test_geometry",
id = 0,
geometry = test_polygon,
referencePoint = point
};
xserver.Geometries test_geometries = new xserver.Geometries();
test_geometries.wrappedGeometries = new xserver.Geometry[] { test_geometry };
test_geometries.wrappedOptions = test_geometryOptions;
xserver.GeometryLayer layer = new xserver.GeometryLayer {
name = "test_geometry_Layer",
drawPriority = 150,
visible = true,
wrappedGeometries = new xserver.Geometries[] { test_geometries },
objectInfos = xserver.ObjectInfoType.GEOMETRY
};
thanks in advance and Kind Regards
Daniele