private void OnEnable() { var path = "Assets/PointBuilder/Data/Editor/PrevData.asset"; var asset = AssetDatabase.LoadAssetAtPath <Data.EditorData>(path); if (asset == null) { asset = CreateInstance <Data.EditorData>(); AssetDatabase.CreateAsset(asset, path); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } _property = asset; _pointBuilder = new PointBuilder(); _uvRenderer = new PreviewRenderer(); _buildRenderer = new PreviewRenderer(); _uvWireMat = new Material(Shader.Find("PointBuilder/Editor/Wireframe")); _uvWireMat.color = _property.wireColor; _uvPointMat = new Material(Shader.Find("PointBuilder/Editor/SimplePoint")); _uvPointMat.color = _property.pointColor; _meshPointMat = new Material(Shader.Find("PointBuilder/Editor/SimplePoint")); _meshPointMat.color = _property.pointColor; _repaint = false; // load preview OnChangeMeshUV(); OnChangePointBuilderSettings(); OnChangePreviewMaterial(); }
public static PointBuilder ParseHeaderInformation(CharSequence text) { PointBuilder fields = new PointBuilder(); Value.ParseHeaderInformation(text, "point", fields); return(fields); }
public static PointValue FromMap(MapValue map) { PointBuilder fields = new PointBuilder(); map.Foreach((key, value) => fields.assign(key.ToLower(), value)); return(FromInputFields(fields)); }
public void ComparePoints_whenAreEqual_should_return_true() { //Arrange var point1 = new PointBuilder().WithX(2).WithY(2).WithZ(2).Build(); var point2 = new PointBuilder().WithX(2).WithY(2).WithZ(2).Build(); //Assert Assert.IsTrue(ComparePoints(point1, point2)); }
internal virtual void MergeWithHeader(PointBuilder header) { this.Crs = string.ReferenceEquals(this.Crs, null) ? header.Crs : this.Crs; this.X = this.X == null ? header.X : this.X; this.Y = this.Y == null ? header.Y : this.Y; this.Z = this.Z == null ? header.Z : this.Z; this.Longitude = this.Longitude == null ? header.Longitude : this.Longitude; this.Latitude = this.Latitude == null ? header.Latitude : this.Latitude; this.Height = this.Height == null ? header.Height : this.Height; this.Srid = this.Srid == -1 ? header.Srid : this.Srid; }
public void GetFirstCubeMatrixPosition_withCorrectOriginpoint_should_return_true() { //Arrange var cube = new CubeBuilder().WithSize(4).WithCenterX(4).WithCenterY(4).WithCenterZ(4).Build(); var point = new PointBuilder().WithX(2).WithY(2).WithZ(2).Build(); //Act var result = cubeManager.GetFirstCubeMatrixPosition(cube); //Assert Assert.IsTrue(ComparePoints(result, point)); }
public void Build_RecordStructPoint_BuildsAppliesModification() { // Arrange var builder = new PointBuilder().As2DX10Y20(); // Act var actual = builder.Build(); // Assert Assert.Equal(10, actual.X); Assert.Equal(20, actual.Y); Assert.Equal(0, actual.Z); }
private void ComputeOverlay(OverlayType opCode) { // copy points from input Geometries. // This ensures that any Point geometries // in the input are considered for inclusion in the result set CopyPoints(0); CopyPoints(1); // node the input Geometries arg[0].ComputeSelfNodes(li, false); arg[1].ComputeSelfNodes(li, false); // compute intersections between edges of the two input geometries arg[0].ComputeEdgeIntersections(arg[1], li, true); EdgeCollection baseSplitEdges = new EdgeCollection(); arg[0].ComputeSplitEdges(baseSplitEdges); arg[1].ComputeSplitEdges(baseSplitEdges); // EdgeCollection splitEdges = baseSplitEdges; // Add the noded edges to this result graph InsertUniqueEdges(baseSplitEdges); ComputeLabelsFromDepths(); ReplaceCollapsedEdges(); graph.AddEdges(edgeList.Edges); ComputeLabelling(); LabelIncompleteNodes(); // The ordering of building the result Geometries is important. // Areas must be built before lines, which must be built before points. // This is so that lines which are covered by areas are not included // explicitly, and similarly for points. FindResultAreaEdges(opCode); CancelDuplicateResultEdges(); PolygonBuilder polyBuilder = new PolygonBuilder(geomFact); polyBuilder.Add(graph); resultPolyList = polyBuilder.Build(); LineBuilder lineBuilder = new LineBuilder(this, geomFact, ptLocator); resultLineList = lineBuilder.Build(opCode); PointBuilder pointBuilder = new PointBuilder(this, geomFact); resultPointList = pointBuilder.Build(opCode); // gather the results from all calculations into a single Geometry for the result set resultGeom = ComputeGeometry(resultPointList, resultLineList, resultPolyList); }
/// <summary> /// Parses the given text into a PointValue. The information stated in the header is saved into the PointValue /// unless it is overridden by the information in the text /// </summary> /// <param name="text"> the input text to be parsed into a PointValue </param> /// <param name="fieldsFromHeader"> must be a value obtained from <seealso cref="parseHeaderInformation(CharSequence)"/> or null </param> </returns> </param> /// <returns> a PointValue instance with information from the {<param name="fieldsFromHeader">} and {<param name="text">} </param> public static PointValue Parse(CharSequence text, CSVHeaderInformation fieldsFromHeader) { PointBuilder fieldsFromData = ParseHeaderInformation(text); if (fieldsFromHeader != null) { // Merge InputFields: Data fields override header fields if (!(fieldsFromHeader is PointBuilder)) { throw new System.InvalidOperationException("Wrong header information type: " + fieldsFromHeader); } fieldsFromData.MergeWithHeader(( PointBuilder )fieldsFromHeader); } return(FromInputFields(fieldsFromData)); }
private static CoordinateReferenceSystem FindSpecifiedCRS(PointBuilder fields) { string crsValue = fields.Crs; int sridValue = fields.Srid; if (!string.ReferenceEquals(crsValue, null) && sridValue != -1) { throw new InvalidValuesArgumentException("Cannot specify both CRS and SRID"); } else if (!string.ReferenceEquals(crsValue, null)) { return(CoordinateReferenceSystem.ByName(crsValue)); } else if (sridValue != -1) { return(CoordinateReferenceSystem.Get(sridValue)); } else { return(null); } }
public async Task PersonalPrivilegePoint(CommandContext ctx, [RemainingText] string point) { bool hasProfanity = profanityFilterService.ProfanityCheck(point); if (hasProfanity) { await profanityFilterService.ProfanityClear(ctx.Channel, ctx.Message); return; } var pointsChannelId = await guilds.GetGuildPointsChannel(ctx.Guild.Id); var channel = pointsChannelId == 0 ? ctx.Channel : ctx.Guild.GetChannel(pointsChannelId); if (pointsChannelId == 0 && channel.Equals(ctx.Channel)) { await channel.SendMessageAsync("Sending message here as motion channel has not been setup"); } var pointEmbed = PointBuilder.BuildPointEmbed(ctx.Member.Username, ctx.Member.AvatarUrl, PointType.PRIVILEGE, point); await channel.SendMessageAsync(pointEmbed); }
public BuilderPoint(PointBuilder builder) { this.builder = builder; }
/// <summary> /// This contains the logic to decide the default coordinate reference system based on the input fields /// </summary> private static PointValue FromInputFields(PointBuilder fields) { CoordinateReferenceSystem crs = FindSpecifiedCRS(fields); double[] coordinates; if (fields.X != null && fields.Y != null) { coordinates = fields.Z != null ? new double[] { fields.X.Value, fields.Y.Value, fields.Z.Value } : new double[] { fields.X.Value, fields.Y.Value }; if (crs == null) { crs = coordinates.Length == 3 ? CoordinateReferenceSystem.Cartesian_3D : CoordinateReferenceSystem.Cartesian; } } else if (fields.Latitude != null && fields.Longitude != null) { if (fields.Z != null) { coordinates = new double[] { fields.Longitude.Value, fields.Latitude.Value, fields.Z.Value }; } else if (fields.Height != null) { coordinates = new double[] { fields.Longitude.Value, fields.Latitude.Value, fields.Height.Value }; } else { coordinates = new double[] { fields.Longitude.Value, fields.Latitude.Value }; } if (crs == null) { crs = coordinates.Length == 3 ? CoordinateReferenceSystem.Wgs84_3d : CoordinateReferenceSystem.Wgs84; } if (!crs.Geographic) { throw new InvalidValuesArgumentException("Geographic points does not support coordinate reference system: " + crs + ". This is set either in the csv header or the actual data column"); } } else { if (crs == CoordinateReferenceSystem.Cartesian) { throw new InvalidValuesArgumentException("A " + CoordinateReferenceSystem.Cartesian.Name + " point must contain 'x' and 'y'"); } else if (crs == CoordinateReferenceSystem.Cartesian_3D) { throw new InvalidValuesArgumentException("A " + CoordinateReferenceSystem.Cartesian_3D.Name + " point must contain 'x', 'y' and 'z'"); } else if (crs == CoordinateReferenceSystem.Wgs84) { throw new InvalidValuesArgumentException("A " + CoordinateReferenceSystem.Wgs84.Name + " point must contain 'latitude' and 'longitude'"); } else if (crs == CoordinateReferenceSystem.Wgs84_3d) { throw new InvalidValuesArgumentException("A " + CoordinateReferenceSystem.Wgs84_3d.Name + " point must contain 'latitude', 'longitude' and 'height'"); } throw new InvalidValuesArgumentException("A point must contain either 'x' and 'y' or 'latitude' and 'longitude'"); } if (crs.Dimension != coordinates.Length) { throw new InvalidValuesArgumentException("Cannot create point with " + crs.Dimension + "D coordinate reference system and " + coordinates.Length + " coordinates. Please consider using equivalent " + coordinates.Length + "D coordinate reference system"); } return(Values.PointValue(crs, coordinates)); }
public void Setup() { _simpleCalculateStrategy = A.Fake <IEquationCalculateStrategy>(); _pointBuilder = new PointBuilder(_pointFactory, _simpleCalculateStrategy); }