本文整理汇总了C#中PointCollection类的典型用法代码示例。如果您正苦于以下问题:C# PointCollection类的具体用法?C# PointCollection怎么用?C# PointCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PointCollection类属于命名空间,在下文中一共展示了PointCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:dolkensp,项目名称:OTWB,代码行数:27,代码来源:RossEngine.cs
示例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));
*/
}
开发者ID:philllies,项目名称:finalproject,代码行数:30,代码来源:DrawInqMode.cs
示例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));
}
开发者ID:jordanparfitt,项目名称:arcgis-runtime-samples-dotnet,代码行数:27,代码来源:Simplify.xaml.cs
示例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;
}
开发者ID:Korshunoved,项目名称:Win10reader,代码行数:31,代码来源:SelectionHelper.cs
示例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));
}
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:31,代码来源:Simplify.xaml.cs
示例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;
}
开发者ID:HackatonArGP,项目名称:Guardianes,代码行数:33,代码来源:WktConverter.cs
示例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;
}
开发者ID:dolkensp,项目名称:OTWB,代码行数:27,代码来源:Barrel.cs
示例8: ParallelCoordsPolyline
public ParallelCoordsPolyline()
{
this.InitializeComponent();
_polylinePoints = new PointCollection();
_selected = false;
_filtered = false;
_searched = false;
}
开发者ID:Poc275,项目名称:DataVisUserControls,代码行数:8,代码来源:ParallelCoordsPolyline.xaml.cs
示例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;
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:8,代码来源:InsertPointsCommand.cs
示例10: InsertPointsCommandFactory
public InsertPointsCommandFactory(WorldEditor worldEditor, IWorldContainer parentObject, int index)
{
this.app = worldEditor;
this.parent = (PointCollection) parentObject;
this.index = index;
// placing = true;
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:8,代码来源:InsertPointsCommandFactory.cs
示例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);
});
}
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:58,代码来源:AddGraphicsRenderer.cs
示例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;
}
开发者ID:jordanparfitt,项目名称:arcgis-runtime-samples-dotnet,代码行数:10,代码来源:SymbolsAndLabels.xaml.cs
示例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);
}
开发者ID:TsvetanMilanov,项目名称:RoomMeasurer,代码行数:9,代码来源:RoomDrawingViewModel.cs
示例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;
}
开发者ID:pheede,项目名称:ArcGIS.PCL,代码行数:15,代码来源:GeometryExtensions.cs
示例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;
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:10,代码来源:MPPoint.cs
示例16: QueryBoxListItemViewModel
public QueryBoxListItemViewModel(TimeSeries ts, int resultNo)
{
TimeSeriesModel = ts;
ResultNo = resultNo.ToString();
Name = ts.MetaData.Name;
Points = new PointCollection();
SelectionX = GraphWidth*ts.MetaData.SelectionStart;
SelectionWidth = GraphWidth * ts.MetaData.SelectionEnd - SelectionX;
UpdateGraph();
}
开发者ID:philllies,项目名称:finalproject,代码行数:10,代码来源:QueryBoxListItemViewModel.cs
示例17: IsCCW
// METHOD IsCCW() IS MODIFIED FROM ANOTHER WORK AND IS ORIGINALLY BASED ON GeoTools.NET:
/*
* Copyright (C) 2002 Urban Science Applications, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/// <summary>
/// Tests whether a ring is oriented counter-clockwise.
/// </summary>
/// <param name="ring">Ring to test.</param>
/// <returns>Returns true if ring is oriented counter-clockwise.</returns>
public static bool IsCCW(PointCollection ring)
{
MapPoint PrevPoint, NextPoint;
MapPoint p;
// Check if the ring has enough vertices to be a ring
if (ring.Count < 3) throw (new ArgumentException("Invalid LinearRing"));
// find the point with the largest Y coordinate
MapPoint hip = ring[0];
int hii = 0;
for (int i = 1; i < ring.Count; i++)
{
p = ring[i];
if (p.Y > hip.Y)
{
hip = p;
hii = i;
}
}
// Point left to Hip
int iPrev = hii - 1;
if (iPrev < 0) iPrev = ring.Count - 2;
// Point right to Hip
int iNext = hii + 1;
if (iNext >= ring.Count) iNext = 1;
PrevPoint = ring[iPrev];
NextPoint = ring[iNext];
// translate so that hip is at the origin.
// This will not affect the area calculation, and will avoid
// finite-accuracy errors (i.e very small vectors with very large coordinates)
// This also simplifies the discriminant calculation.
double prev2X = PrevPoint.X - hip.X;
double prev2Y = PrevPoint.Y - hip.Y;
double next2X = NextPoint.X - hip.X;
double next2Y = NextPoint.Y - hip.Y;
// compute cross-product of vectors hip->next and hip->prev
// (e.g. area of parallelogram they enclose)
double disc = next2X*prev2Y - next2Y*prev2X;
// If disc is exactly 0, lines are collinear. There are two possible cases:
// (1) the lines lie along the x axis in opposite directions
// (2) the line lie on top of one another
// (2) should never happen, so we're going to ignore it!
// (Might want to assert this)
// (1) is handled by checking if next is left of prev ==> CCW
if (disc == 0.0)
{
// poly is CCW if prev x is right of next x
return (PrevPoint.X > NextPoint.X);
}
// if area is positive, points are ordered CCW
return (disc > 0.0);
}
开发者ID:pakrym,项目名称:PatrolControl,代码行数:79,代码来源:Algorithms.cs
示例18: FromArray
// Helper method
private static PointCollection FromArray(params double[] parameters)
{
PointCollection coll = new PointCollection(SpatialReferences.Wgs84);
var mapPointBuilder = new MapPointBuilder(SpatialReferences.Wgs84);
for (int i = 0; i < parameters.Length - 1; i+=2)
{
mapPointBuilder.SetValues(parameters[i], parameters[i + 1]);
coll.Add(mapPointBuilder.ToGeometry());
}
return coll;
}
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:12,代码来源:SymbolsAndLabels.xaml.cs
示例19: SetPolylinePointsProperty
protected void SetPolylinePointsProperty(Polyline polyline, PointCollection pointCollection)
{
// Changing .Points during an Arrange pass can create a layout cycle on Silverlight
if (!polyline.Points.SequenceEqual(pointCollection))
{
polyline.Points = pointCollection;
// In rare cases, Silverlight doesn't update the line visual to match the new points;
// calling InvalidateArrange works around that problem.
polyline.InvalidateArrange();
}
}
开发者ID:siatwangmin,项目名称:WinRTXamlToolkit,代码行数:11,代码来源:StackedLineSeries.cs
示例20: Hex
public Hex(LandType type)
{
landType = type;
diceRollValue = -1;
neighboringHexes = new Hex[6];
Points = new PointCollection();
for (int i = 0; i < 6; ++i)
{
neighboringHexes[i] = null;
}
}
开发者ID:Lepercon5000,项目名称:socsim,代码行数:12,代码来源:Hex.cs
注:本文中的PointCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论