本文整理汇总了C#中PointCollection类的典型用法代码示例。如果您正苦于以下问题:C# PointCollection类的具体用法?C# PointCollection怎么用?C# PointCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PointCollection类属于命名空间,在下文中一共展示了PointCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RossCalculate1
private PointCollection RossCalculate1(RossData CurrentData, double inc)
{
PointCollection points = new PointCollection();
var maxAngle = CurrentData.SuggestedMaxTurns * 2 * Math.PI;
var X = 0.0;
var Y = 0.0;
var N = (CurrentData.N == -CurrentData.N)
? CurrentData.N - 1.0
: CurrentData.N + 1.0;
var Phi1 = FNR(CurrentData.Phi1);
var Phi2 = FNR(CurrentData.Phi2);
var Phi3 = FNR(CurrentData.Phi3);
X = CurrentData.Ex1 * Math.Cos(0) + CurrentData.SR * Math.Cos(Phi1) + CurrentData.Fl * Math.Cos(Phi2) + CurrentData.Fr * Math.Cos(Phi3);
Y = CurrentData.Ex1 * Math.Sin(0) + CurrentData.SR * Math.Sin(Phi1) + CurrentData.Fl * Math.Sin(Phi2) + CurrentData.Fr * Math.Sin(Phi3);
points.Add(new Point(X, Y));
for (var Theta = inc; Theta <= maxAngle; Theta += inc)
{
X = CurrentData.Ex1 * Math.Cos(Theta) + CurrentData.SR * Math.Cos(N * Theta + Phi1) + CurrentData.Fl * Math.Cos(CurrentData.M * Theta + Phi2) + CurrentData.Fr * Math.Cos(CurrentData.L * Theta + Phi3);
Y = CurrentData.Ex1 * Math.Sin(Theta) + CurrentData.SR * Math.Sin(N * Theta + Phi1) + CurrentData.Fl * Math.Sin(CurrentData.M * Theta + Phi2) + CurrentData.Fr * Math.Sin(CurrentData.L * Theta + Phi3);
points.Add(new Point(X, Y));
}
return points;
}
示例2: OnPointerPressed
public void OnPointerPressed(InqCanvas inqCanvas, PointerRoutedEventArgs e)
{
Debug.WriteLine(e.Pointer.PointerDeviceType);
_currentStroke = new PointCollection();
_polyline = new Polyline
{
Stroke = new SolidColorBrush(StrokeColor),
StrokeThickness = 3,
StrokeLineJoin = PenLineJoin.Round
};
inqCanvas.Children.Add(_polyline);
_polyline.Points = _currentStroke;
var point = e.GetCurrentPoint(inqCanvas);
_strokeBuilder.BeginStroke(point);
_currentStroke.Add(point.Position);
//_inkManager.
/*
//TODO: add data binding for thickness and color
_currentStroke.StrokeThickness = Math.Max(4.0 * e.GetCurrentPoint(inqCanvas).Properties.Pressure, 2);
_currentInqLineView.StrokeThickness = _currentStroke.StrokeThickness;
inqCanvas.Children.Add(_currentInqLineView);
var currentPoint = e.GetCurrentPoint(inqCanvas);
_currentStroke.AddPoint(new Point(currentPoint.Position.X, currentPoint.Position.Y));
*/
}
示例3: DrawPolygon
// Draw the unsimplified polygon
private void DrawPolygon()
{
MapPoint center = MyMapView.Extent.GetCenter();
double lat = center.Y;
double lon = center.X + 300;
double latOffset = 300;
double lonOffset = 300;
var points = new PointCollection()
{
new MapPoint(lon - lonOffset, lat),
new MapPoint(lon, lat + latOffset),
new MapPoint(lon + lonOffset, lat),
new MapPoint(lon, lat - latOffset),
new MapPoint(lon - lonOffset, lat),
new MapPoint(lon - 2 * lonOffset, lat + latOffset),
new MapPoint(lon - 3 * lonOffset, lat),
new MapPoint(lon - 2 * lonOffset, lat - latOffset),
new MapPoint(lon - 1.5 * lonOffset, lat + latOffset),
new MapPoint(lon - lonOffset, lat)
};
_unsimplifiedPolygon = new Polygon(points, MyMapView.SpatialReference);
_polygonOverlay.Graphics.Clear();
_polygonOverlay.Graphics.Add(new Graphic(_unsimplifiedPolygon));
}
示例4: GetSelectionPolygon
public static PointCollection GetSelectionPolygon(Rect topRect, Rect bottomRect, double width, double offsetX, double lineInterval)
{
double lineIntervalCompensation = 0;
if(lineInterval < 1)
{
lineIntervalCompensation = 1 - lineInterval;
}
double topRectCompensation = topRect.Height * lineIntervalCompensation;
double bottmRectCompensation = bottomRect.Height * lineIntervalCompensation;
var pointCollection = new PointCollection();
if (topRect.Top < bottomRect.Top)
{
pointCollection.Add(new Point(offsetX, topRect.Bottom));
pointCollection.Add(new Point(topRect.Left, topRect.Bottom));
pointCollection.Add(new Point(topRect.Left, topRect.Top + topRectCompensation));
pointCollection.Add(new Point(width - offsetX, topRect.Top + topRectCompensation));
pointCollection.Add(new Point(width - offsetX, bottomRect.Top + bottmRectCompensation));
pointCollection.Add(new Point(bottomRect.Right, bottomRect.Top + bottmRectCompensation));
pointCollection.Add(new Point(bottomRect.Right, bottomRect.Bottom));
pointCollection.Add(new Point(offsetX, bottomRect.Bottom));
}
else
{
pointCollection.Add(new Point(topRect.Left, topRect.Bottom));
pointCollection.Add(new Point(topRect.Left, topRect.Top + topRectCompensation));
pointCollection.Add(new Point(bottomRect.Right, bottomRect.Top + bottmRectCompensation));
pointCollection.Add(new Point(bottomRect.Right, bottomRect.Bottom));
}
return pointCollection;
}
示例5: DrawPolygon
// Draw the unsimplified polygon
private void DrawPolygon()
{
// Get current viewpoints extent from the MapView
var currentViewpoint = MyMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry);
var viewpointExtent = currentViewpoint.TargetGeometry.Extent;
MapPoint center = viewpointExtent.GetCenter();
double lat = center.Y;
double lon = center.X + 300;
double latOffset = 300;
double lonOffset = 300;
var points = new PointCollection()
{
new MapPoint(lon - lonOffset, lat),
new MapPoint(lon, lat + latOffset),
new MapPoint(lon + lonOffset, lat),
new MapPoint(lon, lat - latOffset),
new MapPoint(lon - lonOffset, lat),
new MapPoint(lon - 2 * lonOffset, lat + latOffset),
new MapPoint(lon - 3 * lonOffset, lat),
new MapPoint(lon - 2 * lonOffset, lat - latOffset),
new MapPoint(lon - 1.5 * lonOffset, lat + latOffset),
new MapPoint(lon - lonOffset, lat)
};
_unsimplifiedPolygon = new Polygon(points, MyMapView.SpatialReference);
_polygonOverlay.Graphics.Clear();
_polygonOverlay.Graphics.Add(new Graphic(_unsimplifiedPolygon));
}
示例6: MultiPolygonWktToPolygon
private static Polygon MultiPolygonWktToPolygon(string wkt)
{
var polygon = new Polygon();
var pointCollection = new PointCollection();
var removed = wkt.Replace("MULTIPOLYGON (", "");
var preSplit = removed.Replace(")), ((", "|");
var rings = preSplit.Split('|');
foreach (var r in rings)
{
PointCollection pc = new PointCollection();
var r1 = r.Replace("(", "");
var r2 = r1.Replace(")", "");
var r3 = r2.Trim();
var coords = r3.Split(',');
foreach(var coord in coords)
{
coord.Trim();
var xy = coord.Trim().Split(' ');
if (xy.Length != 2)
continue;
pc.Add(new MapPoint(double.Parse(xy[0], CultureInfo.InvariantCulture), double.Parse(xy[1], CultureInfo.InvariantCulture)));
}
polygon.Rings.Add(pc);
}
return polygon;
}
示例7: BarrelOutline
public PointCollection BarrelOutline(double inc)
{
PointCollection pc = new PointCollection();
double phse = rad * Phase;
double lastr = 0;
double r;
double tp;
double a = 0;
Point pd;
int N = (int)Math.Floor(1.0 / inc);
for (double i = 1; i < N; i++)
{
double f = i * inc;
r = CalcR(f, 0);
a = f * twopi + phse;
tp = ToolPosition + r - lastr;
pd = new Point(tp * Math.Cos(a), tp * Math.Sin(a));
pc.Add(pd);
lastr = r;
}
r = CalcR(1.0, 0);
a = twopi + phse;
tp = ToolPosition + r - lastr;
pd = new Point(tp * Math.Cos(a), tp * Math.Sin(a));
pc.Add(pd);
return pc;
}
示例8: ParallelCoordsPolyline
public ParallelCoordsPolyline()
{
this.InitializeComponent();
_polylinePoints = new PointCollection();
_selected = false;
_filtered = false;
_searched = false;
}
示例9: InsertPointsCommand
public InsertPointsCommand(WorldEditor worldEditor, IWorldContainer parent, Vector3 newPoint, int index)
{
this.app = worldEditor;
this.parent = (PointCollection) parent;
this.newPoint = newPoint;
this.index = index;
this.placing = true;
}
示例10: InsertPointsCommandFactory
public InsertPointsCommandFactory(WorldEditor worldEditor, IWorldContainer parentObject, int index)
{
this.app = worldEditor;
this.parent = (PointCollection) parentObject;
this.index = index;
// placing = true;
}
示例11: OnViewpointChanged
private void OnViewpointChanged(object sender, EventArgs e)
{
// Unhook the event
_myMapView.ViewpointChanged -= OnViewpointChanged;
// Get area that is shown in a MapView
Polygon visibleArea = _myMapView.VisibleArea;
// Get extent of that area
Envelope extent = visibleArea.Extent;
// Get central point of the extent
MapPoint centerPoint = extent.GetCenter();
// Create values inside the visible extent for creating graphic
var extentWidth = extent.Width / 5;
var extentHeight = extent.Height / 10;
// Create point collection
PointCollection points = new PointCollection(SpatialReferences.WebMercator)
{
new MapPoint(centerPoint.X - extentWidth * 2, centerPoint.Y - extentHeight * 2),
new MapPoint(centerPoint.X - extentWidth * 2, centerPoint.Y + extentHeight * 2),
new MapPoint(centerPoint.X + extentWidth * 2, centerPoint.Y + extentHeight * 2),
new MapPoint(centerPoint.X + extentWidth * 2, centerPoint.Y - extentHeight * 2)
};
// Create overlay to where graphics are shown
GraphicsOverlay overlay = new GraphicsOverlay();
// Add points to the graphics overlay
foreach (var point in points)
{
// Create new graphic and add it to the overlay
overlay.Graphics.Add(new Graphic(point));
}
// Create symbol for points
SimpleMarkerSymbol pointSymbol = new SimpleMarkerSymbol()
{
Color = System.Drawing.Color.Yellow,
Size = 30,
Style = SimpleMarkerSymbolStyle.Square,
};
// Create simple renderer with symbol
SimpleRenderer renderer = new SimpleRenderer(pointSymbol);
// Set renderer to graphics overlay
overlay.Renderer = renderer;
// Make sure that the UI changes are done in the UI thread
RunOnUiThread(() =>
{
// Add created overlay to the MapView
_myMapView.GraphicsOverlays.Add(overlay);
});
}
示例12: FromArray
// Helper method
private static PointCollection FromArray(params double[] parameters)
{
PointCollection coll = new PointCollection();
for (int i = 0; i < parameters.Length - 1; i+=2)
{
coll.Add(new MapPoint(parameters[i], parameters[i + 1]));
}
return coll;
}
示例13: RoomDrawingViewModel
public RoomDrawingViewModel()
{
this.roomCorners = new PointCollection();
this.Translate = new DelegateCommandWithParameter<ManipulationDeltaRoutedEventArgs>(this.ExecuteTranslateCommand);
this.DisableInertia = new DelegateCommandWithParameter<ManipulationInertiaStartingRoutedEventArgs>(this.ExecuteDisableInertiaCommand);
this.Scale = new DelegateCommandWithParameter<ManipulationDeltaRoutedEventArgs>(this.ExecuteScaleCommand);
this.BackToMainMenu = new DelegateCommand(this.ExecuteBackToMainMenuCommand);
this.ShowWallSizes = new DelegateCommand(this.ExecuteShowWallSizesCommand);
}
示例14: ToPointCollectionList
/// <summary>
/// Convert a collection of points into a <see cref="PointCollectionList"/> that can be used as paths in <see cref="Polyline"/> types
/// or rings in <see cref="Polygon"/> types
/// </summary>
/// <param name="points"></param>
/// <returns></returns>
public static PointCollectionList ToPointCollectionList(this IEnumerable<Point> points)
{
var result = new PointCollectionList();
var pointCollection = new PointCollection();
foreach (var point in points)
pointCollection.Add(point.ToPointCollectionEntry());
result.Add(pointCollection);
return result;
}
示例15: MPPoint
public MPPoint(int pointNum, PointCollection parent, WorldEditor worldEditor, string meshName, string meshMaterial, Vector3 position, MPPointType type)
{
this.PointNum = pointNum;
this.parent = parent;
this.app = worldEditor;
this.meshName = meshName;
this.meshMaterial = meshMaterial;
this.position = position;
this.type = type;
}