protected override void InternalSolve() { ReinitializePrivates(); InitializeMoveFactories(); while (!TimeToEnd()) { _bestFactory = null; _bestMove = null; foreach (ITransformationFactory factory in MoveFactories) { if (TimeToEnd()) { break; } AssesMovesFromFactory(factory); } ChooseToPerform(); } if (_previousBest != null && _previousBest.IsBetterThan(Solution)) { Solution = _previousBest; _previousBest.RestoreStructures(); _scoringFunction.AssesSolution(Solution); } if (DiagnosticMessages) { Console.WriteLine($"Number of transformations performed {NumberOfMoves}."); } }
private Discrete( TValue na, ITransformation <TKey> transformation) : base(transformation) { this.na = na; }
public static ITransformation Chain(this ITransformation first, ITransformation second) { if(first == null) throw new ArgumentNullException("first"); if(second == null) throw new ArgumentNullException("second"); // check if first is chained ChainedTransformation chained = first as ChainedTransformation; // no? try second argument if(chained == null) { chained = second as ChainedTransformation; } if(chained != null) { chained.Add(second); return chained; } return new ChainedTransformation(first, second); }
public ColorDiscrete( string[] palette, int direction = 1, ITransformation <TKey> transformation = null) : base(palette, direction, default, transformation) { }
public TransformationBuilder Zoom( PointF zoomPoint, float zoomValue) { _toReturn = new Zoom(_toReturn, zoomPoint, zoomValue); return(this); }
public void ProjectExWithGeoTransformationAndHintPerformanceTest() { IPolygon polygon = CreateTestPolygon(); const int count = 100; IEnumerable <IPolygon> clones = GetClones(polygon, count); var stopwatch = new Stopwatch(); stopwatch.Start(); esriTransformDirection direction; ITransformation transformation = GetGeoTransformationToLv95(out direction); foreach (IPolygon clone in clones) { int hint = 0; ((ISpatialReference3)_wgs84).ProjectionHint(clone, _lv95, ref direction, ref transformation, ref hint); ((IGeometry5)clone).ProjectEx5(_lv95, direction, transformation, false, 0, 0, hint); } stopwatch.Stop(); // NOTE: projection WITHOUT the hint is FASTER overall. Console.WriteLine(@"{0:N2} ms per polygon", stopwatch.ElapsedMilliseconds / count); }
private void btnOK_Click(object sender, RoutedEventArgs e) { bool fxSucceed = double.TryParse(txtFromX.Text, out double fromX); bool fySucceed = double.TryParse(txtFromY.Text, out double fromY); bool fzSucceed = double.TryParse(txtFromZ.Text, out double fromZ); bool txSucceed = double.TryParse(txtToX.Text, out double toX); bool tySucceed = double.TryParse(txtToY.Text, out double toY); bool tzSucceed = double.TryParse(txtToZ.Text, out double toZ); bool uxSucceed = double.TryParse(txtUpX.Text, out double upX); bool uySucceed = double.TryParse(txtUpY.Text, out double upY); bool uzSucceed = double.TryParse(txtUpZ.Text, out double upZ); if (fxSucceed && fySucceed && fzSucceed && txSucceed && tySucceed && tzSucceed && uxSucceed && uySucceed && uzSucceed) { viewTransform = new ViewTransform(fromX, fromY, fromZ, toX, toY, toZ, upX, upY, upZ); } else { viewTransform = null; } Close(); }
private void execAdjust(ITransformation trans) { if (DialogResult.Yes != MessageBox.Show("是否确定执行转换?", "", MessageBoxButtons.YesNo)) { return; } for (int i = 0; i < m_CmdSetAdjustData.ListLayers.Count; i++) { //获得layer IFeatureClass pFC = ((IFeatureLayer)findLayer(m_CmdSetAdjustData.ListLayers[i])).FeatureClass; IFeatureCursor pFCursor = pFC.Update(null, false); IFeature pF = pFCursor.NextFeature(); while (pF != null) { ITransform2D pTrans = pF.Shape as ITransform2D; pTrans.Transform(esriTransformDirection.esriTransformForward, trans); pF.Store(); pF = pFCursor.NextFeature(); } } m_NewDisplacement.OriginPoints.RemovePoints(0, m_NewDisplacement.OriginPoints.PointCount); m_NewDisplacement.TargetPoints.RemovePoints(0, m_NewDisplacement.TargetPoints.PointCount); m_NewDisplacement.VectorLinkTable.RefreshDataTable(); m_NewDisplacement.RefreshLayer(); m_pControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null); }
/// <summary> /// Flip. /// </summary> /// <param name="transform">Transform.</param> /// <param name="direction">Flip direction.</param> /// <returns>Transform.</returns> public static ITransformation Flip(this ITransformation transform, FlipDirection direction) { switch (direction) { case FlipDirection.Both: transform.Translate(transform.Width, transform.Height); transform.Scale(-1.0, -1.0); break; case FlipDirection.Horizontal: transform.Translate(0, transform.Height); transform.Scale(1.0, -1.0); break; case FlipDirection.Vertical: transform.Translate(transform.Width, 0); transform.Scale(-1.0, 1.0); break; default: throw new Exception($"Unsupported flip direction: {direction}"); } return(transform); }
public void Render(ITransformation camera) { #if SOLUTION for (int i = 0; i < instanceCount; ++i) { instancePositions[i] += instanceVelocity[i]; var abs = Vector3.One - Vector3.Abs(instancePositions[i]); if (abs.X < 0 || abs.Y < 0 || abs.Z < 0) { instanceVelocity[i] = -instanceVelocity[i]; } instanceRotation[i] += 0.1f; } geometry.SetAttribute(shaderProgram.GetResourceLocation(ShaderResourceType.Attribute, "instancePosition"), instancePositions, true); geometry.SetAttribute(shaderProgram.GetResourceLocation(ShaderResourceType.Attribute, "instanceRotation"), instanceRotation, true); #endif GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); shaderProgram.Activate(); #if SOLUTION shaderProgram.Uniform("camera", camera); #endif geometry.Draw(); shaderProgram.Deactivate(); }
public void DrawMeshVertices(ITransformation transformation, IEnumerable <IMesh> meshes, ushort?colorOverride = null, byte?pixelOverride = null) { foreach (var mesh in meshes) { DrawMeshVertices(transformation, mesh, colorOverride, pixelOverride); } }
/// <summary> /// 实现对要素类的坐标的仿射变换 /// </summary> /// <param name="inFC">要素类</param> /// <param name="inTransformation">转换类</param> private void coordTransfermation(IFeatureClass inFC, ITransformation inTransformation) { IFeatureCursor pFCursor = inFC.Update(null, false); IFeature pFeature = pFCursor.NextFeature(); while (pFeature != null) { IGeometry shpTransformed = pFeature.ShapeCopy; ITransform2D pTransform2D = shpTransformed as ITransform2D; pTransform2D.Transform(esriTransformDirection.esriTransformForward, inTransformation); pFeature.Shape = shpTransformed; //int id = inFC.FindField("LAYER_OID"); //if((inFC as IDataset).Name=="宗地_Project54_1") //pFeature.set_Value(id,"1"); pFCursor.UpdateFeature(pFeature); //cursor后移 pFeature = pFCursor.NextFeature(); } Marshal.ReleaseComObject(pFCursor);//释放cursor ISpatialReference unKnownSR = new UnknownCoordinateSystemClass(); IGeoDatasetSchemaEdit pGDSE = inFC as IGeoDatasetSchemaEdit; if (pGDSE.CanAlterSpatialReference) { pGDSE.AlterSpatialReference(unKnownSR);//更新要素类的投影 } IFeatureClassManage pFCM = inFC as IFeatureClassManage; pFCM.UpdateExtent();//更新要素类的最值范围 IGeoDataset pGD = inFC as IGeoDataset; IEnvelope ppp = pGD.Extent; }
public void DrawMeshVertices(ITransformation transformation, IMesh mesh, ushort?colorOverride = null, byte?pixelOverride = null) { foreach (var face in mesh.Faces) { DrawPoints(transformation, face.Points, colorOverride, pixelOverride); } }
public void DrawPoints(ITransformation transformation, IEnumerable <Vector3> points, ushort?colorOverride = null, byte?pixelOverride = null) { foreach (var point in points) { DrawPoint(transformation, point, colorOverride, pixelOverride); } }
public void DrawMeshBoundingBox(ITransformation transformation, IMesh mesh, ushort?colorOverride = null, byte?pixelOverride = null) { if (mesh.Minimums.HasValue && mesh.Maximums.HasValue) { var meshMinimums = mesh.Minimums.Value; var meshMaximums = mesh.Maximums.Value; var nearBottomLeftPoint = new Vector3(meshMinimums.X, meshMinimums.Y, meshMaximums.Z); var farBottomLeftPoint = new Vector3(meshMinimums.X, meshMinimums.Y, meshMinimums.Z); var nearBottomRightPoint = new Vector3(meshMaximums.X, meshMinimums.Y, meshMaximums.Z); var farBottomRightPoint = new Vector3(meshMaximums.X, meshMinimums.Y, meshMinimums.Z); var nearTopRightPoint = new Vector3(meshMaximums.X, meshMaximums.Y, meshMaximums.Z); var farTopRightPoint = new Vector3(meshMaximums.X, meshMaximums.Y, meshMinimums.Z); var nearTopLeftPoint = new Vector3(meshMinimums.X, meshMaximums.Y, meshMaximums.Z); var farTopLeftPoint = new Vector3(meshMinimums.X, meshMaximums.Y, meshMinimums.Z); DrawLine(transformation, nearBottomLeftPoint, farBottomLeftPoint, colorOverride, pixelOverride); DrawLine(transformation, nearBottomRightPoint, farBottomRightPoint, colorOverride, pixelOverride); DrawLine(transformation, nearTopRightPoint, farTopRightPoint, colorOverride, pixelOverride); DrawLine(transformation, nearTopLeftPoint, farTopLeftPoint, colorOverride, pixelOverride); DrawLine(transformation, nearBottomLeftPoint, nearBottomRightPoint, colorOverride, pixelOverride); DrawLine(transformation, nearBottomRightPoint, nearTopRightPoint, colorOverride, pixelOverride); DrawLine(transformation, nearTopRightPoint, nearTopLeftPoint, colorOverride, pixelOverride); DrawLine(transformation, nearTopLeftPoint, nearBottomLeftPoint, colorOverride, pixelOverride); DrawLine(transformation, farBottomLeftPoint, farBottomRightPoint, colorOverride, pixelOverride); DrawLine(transformation, farBottomRightPoint, farTopRightPoint, colorOverride, pixelOverride); DrawLine(transformation, farTopRightPoint, farTopLeftPoint, colorOverride, pixelOverride); DrawLine(transformation, farTopLeftPoint, farBottomLeftPoint, colorOverride, pixelOverride); } }
private void ApplyRegularBacktransformation(ITransformation transformation, IEnumerable<VariableTreeNode> variableNodes) { foreach (var variableNode in variableNodes) { // generate new subtrees because same subtree cannot be added more than once var transformationTree = transformationMapper.GenerateModel(transformation); SwapVariableWithTree(variableNode, transformationTree); } }
private void DrawShadowSurface(Vector3 lightDirection, ITransformation lightCamera, ITexture2D positions, ITexture2D normals) { _outputSurface.Activate(); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); _shadowShader.Activate(); _depthSurface.Texture.WrapFunction = TextureWrapFunction.ClampToEdge; _shadowShader.ActivateTexture("lightDepth", 0, _depthSurface.Texture); _shadowShader.ActivateTexture("positions", 1, positions); _shadowShader.ActivateTexture("normals", 2, normals); _shadowShader.Uniform("lightDirection", lightDirection); _shadowShader.Uniform("lightCamera", lightCamera); GL.DrawArrays(PrimitiveType.Quads, 0, 4); _shadowShader.DeactivateTexture(2, normals); _shadowShader.DeactivateTexture(1, positions); _shadowShader.DeactivateTexture(0, _depthSurface.Texture); _shadowShader.Deactivate(); _outputSurface.Deactivate(); }
public LineTypeDiscrete( LineType[]?palette = null, int direction = 1, ITransformation <TKey>?transformation = null) : base(palette ?? lineTypes, direction, default, transformation) { }
public TransformationBuilder Translate( float translateX, float translateY) { _toReturn = new Translation(_toReturn, translateX, translateY); return(this); }
public void Add(ITransformation transformation) { if(transformation == null) throw new ArgumentNullException("transformation"); _transformations.Add(transformation); }
public void Draw(ITransformation camera) { var cameraUniform = new TransformUniform(nameof(camera), camera); mrtSurface.Execute(() => { GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); renderState.Set(new FaceCullingModeState(FaceCullingMode.BACK_SIDE)); renderState.Set(new DepthTest(true)); foreach (var vis in meshVisuals) { vis.SetUniform(cameraUniform); //TODO: only once per shader vis.Draw(); } renderState.Set(new DepthTest(false)); }); //TextureDebugger.Draw(mrtSurface.Textures.ElementAt(1)); return; GL.Clear(ClearBufferMask.ColorBufferBit); renderState.Set(BlendStates.Additive); renderState.Set(new FaceCullingModeState(FaceCullingMode.FRONT_SIDE)); // important to cull for light volume rendering, otherwise we would have lighting partly twice applied and to cull front face, otherwise near clipping artifacts lightsVisual.SetUniform(cameraUniform); lightsVisual.Draw(); renderState.Set(BlendStates.Opaque); }
public Zoom(ITransformation transformation, PointF fixedPoint, float zoomValue) : base(transformation) { _fixedPoint = fixedPoint; _zoomValue = zoomValue; }
public AFormat TransformTo(String fName) { ITransformation step1 = TransformationFactory.CreateTransformation(Name, "find"), step2 = TransformationFactory.CreateTransformation("find", fName); return(step2.Transform(step1.Transform(this))); }
public Translation(ITransformation transformation, float xTranslation, float yTranslation) : base(transformation) { _xTranslation = xTranslation; _yTranslation = yTranslation; }
public void DrawWithPostProcessing(float time, ITransformation camera) { renderToTexture.Activate(); //start drawing into texture Draw(camera); renderToTexture.Deactivate(); //stop drawing into texture renderToTexture.Activate(); renderToTexture.Texture.Activate(); //use this new texture for (int i = 0; i < shaderPostProcess.Count - 1; i++) { shaderPostProcess[i].Activate(); //activate post processing shader shaderPostProcess[i].Uniform("iGlobalTime", time); GL.DrawArrays(PrimitiveType.Quads, 0, 4); //draw quad shaderPostProcess[i].Deactivate(); } renderToTexture.Deactivate(); shaderPostProcess[shaderPostProcess.Count - 1].Activate(); //activate post processing shader shaderPostProcess[shaderPostProcess.Count - 1].Uniform("iGlobalTime", time); GL.DrawArrays(PrimitiveType.Quads, 0, 4); //draw quad shaderPostProcess[shaderPostProcess.Count - 1].Deactivate(); renderToTexture.Texture.Deactivate(); }
public void DrawMeshCenters(ITransformation transformation, IMesh mesh, ushort?colorOverride = null, byte?pixelOverride = null) { if (mesh.Centers.HasValue && mesh.Minimums.HasValue && mesh.Maximums.HasValue) { var meshMinimums = mesh.Minimums.Value; var meshMaximums = mesh.Maximums.Value; var meshCenters = mesh.Centers.Value; var distanceX = meshMaximums.X - meshMinimums.X; var distanceY = meshMaximums.Y - meshMinimums.Y; var distanceZ = meshMaximums.Z - meshMinimums.Z; var maxDistance = System.Math.Max(distanceX, System.Math.Max(distanceY, distanceZ)); var meshCenterLineXStart = new Vector3(meshMinimums.X - maxDistance / 4, meshCenters.Y, meshCenters.Z); var meshCenterLineXEnd = new Vector3(meshMaximums.X + maxDistance / 4, meshCenters.Y, meshCenters.Z); DrawLine(transformation, meshCenterLineXStart, meshCenterLineXEnd, colorOverride, pixelOverride); var meshCenterLineYStart = new Vector3(meshCenters.X, meshMinimums.Y - maxDistance / 4, meshCenters.Z); var meshCenterLineYEnd = new Vector3(meshCenters.X, meshMaximums.Y + maxDistance / 4, meshCenters.Z); DrawLine(transformation, meshCenterLineYStart, meshCenterLineYEnd, colorOverride, pixelOverride); var meshCenterLineZStart = new Vector3(meshCenters.X, meshCenters.Y, meshMinimums.Z - maxDistance / 4); var meshCenterLineZEnd = new Vector3(meshCenters.X, meshCenters.Y, meshMaximums.Z + maxDistance / 4); DrawLine(transformation, meshCenterLineZStart, meshCenterLineZEnd, colorOverride, pixelOverride); } }
/// <summary> /// Rotate in degress around center point. /// </summary> /// <param name="transform">Transform.</param> /// <param name="degrees">Degrees to rotate.</param> /// <returns>Transform.</returns> public static ITransformation RotateInDegrees(this ITransformation transform, double degrees) { return(transform.RotateInDegrees( degrees: degrees, x: (int)(transform.Width / 2.0), y: (int)(transform.Height / 2.0))); }
/// <summary> /// 转换多个坐标 /// </summary> /// <param name="transformation"></param> /// <param name="coordinates"></param> /// <returns></returns> public static List <ICoordinate> TransformCoordinates(this ITransformation transformation, IEnumerable <ICoordinate> coordinates) { List <ICoordinate> destCoordinates = new List <ICoordinate>(); if (transformation == null || coordinates == null) { return(destCoordinates); } var count = coordinates.Count(); if (count > 0) { double[] xs = new double[count]; double[] ys = new double[count]; double[] zs = new double[count]; for (int i = 0; i < count; i++) { var coord = coordinates.ElementAt(i); xs[i] = coord.X; ys[i] = coord.Y; if (!double.IsNaN(coord.Z)) { zs[i] = coord.Z; } } transformation.TransformPoints(count, xs, ys, zs); for (int i = 0; i < count; i++) { var coord = new Coordinate(xs[i], ys[i], zs[i]); destCoordinates.Add(coord); } } return(destCoordinates); }
/// <summary> /// 转换坐标 /// </summary> /// <param name="coordinate"></param> /// <returns></returns> public static ICoordinate TransformCoordinate(this ITransformation transformation, ICoordinate coordinate) { ICoordinate destCoord = coordinate; if (transformation == null || coordinate == null || coordinate.IsEmpty()) { return(destCoord); } double[] array; if (!double.IsNaN(coordinate.Z)) { array = new double[] { coordinate.X, coordinate.Y, coordinate.Z }; } else { array = new double[] { coordinate.X, coordinate.Y }; } transformation.TransformPoint(array); if (!double.IsNaN(coordinate.Z)) { destCoord = new Coordinate(array[0], array[1], array[2]); } else { destCoord = new Coordinate(array[0], array[1]); } return(destCoord); }
public TransformationBuilder Affine(float cell_11, float cell_12, float cell_21, float cell_22, float translationX, float translationY) { _toReturn = new Affine(_toReturn, cell_11, cell_12, cell_21, cell_22, translationX, translationY); return(this); }
public static Image StyleToImage(ISymbol sym, int width, int height) { if (sym == null) { return(null); } try { Image image = new Bitmap(width, height); Graphics graphics = Graphics.FromImage(image); IntPtr hdc = graphics.GetHdc(); IEnvelope env = new EnvelopeClass(); env.XMin = 1.0; env.XMax = width - 1; env.YMin = 1.0; env.YMax = height - 1; IGeometry geometry = CreateGeometryFromSymbol(sym, env); if (geometry != null) { ITransformation transformation = DisplayHelper.CreateTransformationFromHDC(hdc, width, height); sym.SetupDC((int)hdc, transformation); sym.Draw(geometry); sym.ResetDC(); } graphics.ReleaseHdc(hdc); return(image); } catch { return(null); } }
public void Render(float deltaTime, ITransformation camera) { if (shaderProgram is null) { return; } //if ((destination - source).LengthSquared() < 0.01) //{ // destination = new Vector3(RndCoord(), RndCoord(), RndCoord()); //} //else //{ // source = MathHelper.Lerp(source, destination, 0.005f); //} //camera.Azimuth += 0.5f; //camera.Elevation += 0.1f; GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); shaderProgram.Activate(); shaderProgram.Uniform("camera", camera); shaderProgram.Uniform(nameof(deltaTime), deltaTime); shaderProgram.Uniform(nameof(source), source); shaderProgram.Uniform(nameof(acceleration), acceleration); shaderProgram.Uniform(nameof(particleCount), particleCount); shaderProgram.Uniform("pointResolutionScale", smallerWindowSideResolution * 0.07f); var bindingIndex = shaderProgram.GetResourceLocation(ShaderResourceType.RWBuffer, "BufferParticle"); bufferParticles.ActivateBind(bindingIndex); GL.DrawArrays(PrimitiveType.Points, 0, particleCount); shaderProgram.Deactivate(); bufferParticles.Deactivate(); }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IDomain domainCasted = item.As <IDomain>(); if ((domainCasted != null)) { this._parent.Domain.Add(domainCasted); } if ((this._parent.Overrides == null)) { IRule overridesCasted = item.As <IRule>(); if ((overridesCasted != null)) { this._parent.Overrides = overridesCasted; return; } } if ((this._parent.Transformation == null)) { ITransformation transformationCasted = item.As <ITransformation>(); if ((transformationCasted != null)) { this._parent.Transformation = transformationCasted; return; } } }
public PostalAddressWrapper(RequestContext context) : base(context, SupportedResourceKinds.postalAddresses) { _entity = new Account(); _transformation = TransformationFactory.GetTransformation<ITransformation<AddressDocument, PostalAddressPayload>> (SupportedResourceKinds.postalAddresses, context); _tradingAccountUuidPayloadPath = _resourceKind.ToString() + "/" + SupportedResourceKinds.tradingAccounts.ToString(); }
public UnitOfMeasureWrapper(RequestContext context) : base(context, SupportedResourceKinds.unitsOfMeasure) { _entity = new UnitOfMeasure(); _transformation = TransformationFactory.GetTransformation <ITransformation<UnitOfMeasureDocument, UnitOfMeasurePayload>> (SupportedResourceKinds.unitsOfMeasure, context); }
public ContactWrapper(RequestContext context) : base(context, SupportedResourceKinds.contacts) { _entity = new Account(); _transformation = TransformationFactory.GetTransformation<ITransformation<PersonDocument, ContactPayload>> (SupportedResourceKinds.contacts, context); _tradingAccountUuidPayloadPath = _resourceKind.ToString() + "/" + SupportedResourceKinds.tradingAccounts.ToString(); }
public PhoneNumberWrapper(RequestContext context) : base(context, SupportedResourceKinds.phoneNumbers) { _entity = new Account(); _transformation = TransformationFactory.GetTransformation<ITransformation<PhoneDocument, PhoneNumberPayload>> (SupportedResourceKinds.phoneNumbers, context); _tradingAccountUuidPayloadPath = _resourceKind.ToString() + "/" + SupportedResourceKinds.tradingAccounts.ToString(); }
public PriceWrapper(RequestContext context) : base(context, SupportedResourceKinds.prices) { _entity = new Price(); _transformation = TransformationFactory.GetTransformation <ITransformation<PriceDocument, PricePayload>> (SupportedResourceKinds.prices, context); }
public GeocentricTransformationGeographicWrapper(ISpheroid<double> fromSpheroid, ISpheroid<double> toSpheroid, ITransformation<Point3> core) : base(fromSpheroid, toSpheroid) { if (null == core) throw new ArgumentNullException("core"); Contract.Requires(fromSpheroid != null); Contract.Requires(toSpheroid != null); _core = core; }
public EmailWrapper(RequestContext context) : base(context, SupportedResourceKinds.emails) { _entity = new Email(); _transformation = TransformationFactory.GetTransformation <ITransformation<EmailDocument, EmailPayload>> (SupportedResourceKinds.emails, context); }
public CommodityGroupWrapper(RequestContext context) : base(context, SupportedResourceKinds.commodityGroups) { _entity = new ProductFamily(); _transformation = TransformationFactory.GetTransformation <ITransformation<ProductFamilyDocument, CommodityGroupPayload>> (SupportedResourceKinds.commodityGroups, context); }
public GeocentricTransformationGeographicWrapper(GeographicGeocentricTransformation geographicGeocentric, GeocentricGeographicTransformation geocentricGeographic, ITransformation<Point3> core) : base(geographicGeocentric, geocentricGeographic) { if (null == core) throw new ArgumentNullException("core"); Contract.Requires(geographicGeocentric != null); Contract.Requires(geocentricGeographic != null); _core = core; }
private void ApplyBacktransformation(ITransformation transformation, ISymbolicExpressionTree symbolicExpressionTree, string targetVariable) { if (transformation.Column != targetVariable) { var variableNodes = symbolicExpressionTree.IterateNodesBreadth() .OfType<VariableTreeNode>() .Where(n => n.VariableName == transformation.Column); ApplyRegularBacktransformation(transformation, variableNodes); } else if (!(transformation is CopyColumnTransformation)) { ApplyInverseBacktransformation(transformation, symbolicExpressionTree); } }
public IldFrame(IldHeader header, IEnumerable<IldRecord> records, ITransformation transformation) { Header = header; Records = records; Transformation = transformation; TracePoints = Records .Select(rec => rec.ToTracePoint()) .ToArray(); Name = Header.FrameName + " #" + Header.FrameNumber; }
public static BoundingBox GetTransformedBoundingBox(ITransformation transformatiom, BoundingBox extent, string fromCRS, string toCRS) { if (!IsTransformationNeeded(fromCRS, toCRS)) return extent; if (!IsProjectionInfoAvailable(transformatiom, fromCRS, toCRS)) return null; if (IsTransformationSupported(transformatiom, fromCRS, toCRS)) return transformatiom.Transform(fromCRS, toCRS, extent); return null; }
private void ApplyInverseBacktransformation(ITransformation transformation, ISymbolicExpressionTree symbolicExpressionTree) { var startSymbol = symbolicExpressionTree.Root.GetSubtree(0); var modelTree = startSymbol.GetSubtree(0); startSymbol.RemoveSubtree(0); var transformationTree = transformationMapper.GenerateInverseModel(transformation); var variableNode = transformationTree.IterateNodesBreadth() .OfType<VariableTreeNode>() .Single(n => n.VariableName == transformation.Column); SwapVariableWithTree(variableNode, modelTree); startSymbol.AddSubtree(transformationTree); }
public static void PerformTransformation(ITransformation transformation, MethodCompileInfo methodCompileInfo) { // TODO: Find and error out on circular transformation dependencies // make sure all required transformations are consistent foreach (Type requiredTransformationType in transformation.Requires) { if (!methodCompileInfo.ConsistentTransformationTypes.Contains(requiredTransformationType)) { // this required transformation is not consistent, perform the transformation PerformTransformation((ITransformation)Activator.CreateInstance(requiredTransformationType), methodCompileInfo); } } transformation.Transform(methodCompileInfo); methodCompileInfo.ConsistentTransformationTypes.Add(transformation.GetType()); methodCompileInfo.ConsistentTransformationTypes -= transformation.Corrupts; }
/// <summary> /// Установить Трансформацию для данного контейнера. /// </summary> public void SetContainerTransformation(ITransformation value) { _procentContainer = new Vector2 { X = value.ClientSize.Width / 100, Y = value.ClientSize.Height / 100 }; Control item; for (int i = 0; i < Count; i++) { item = this[i]; Control.SetControlLockedTransformation(item, false); item.Location = Vector2.Min(Vector2.Max(Vector2.Zero, item.Location), FullProcent); item.Location *= _procentContainer; item.Size = Vector2.Min(Vector2.Max(Vector2.Zero, item.Size), FullProcent); item.Size *= _procentContainer; Control.SetControlLockedTransformation(item); } }
/// <summary> /// Constructor /// </summary> /// <param name="transformationAgent">Transformation agent instance, /// [null] by default - singleton will be used</param> public CalibrationHelper(ITransformation transformationAgent = null) { _transformationAgent = transformationAgent ?? TransformAgent.Data; }
private Inverse(GeographicGeocentricTransformation geographicGeocentric, GeocentricGeographicTransformation geocentricGeographic, MolodenskyBadekasGeographicTransformation core) : base(geographicGeocentric, geocentricGeographic) { _core = core; Contract.Requires(core != null); Contract.Requires(core.MolodenskyBadekas.HasInverse); Contract.Requires(geographicGeocentric != null); Contract.Requires(geocentricGeographic != null); _mbInverse = _core.MolodenskyBadekas.GetInverse(); }
public Frame(TracePoint[] tracePoints, ITransformation transformation, string name) { TracePoints = tracePoints; Transformation = transformation; Name = name; }
private static bool IsProjectionInfoAvailable(ITransformation transformation, string fromCRS, string toCRS) { return !string.IsNullOrEmpty(fromCRS) && !string.IsNullOrEmpty(toCRS) && transformation != null; }
private static bool IsTransformationSupported(ITransformation transformation, string fromCRS, string toCRS) { return transformation.IsProjectionSupported(fromCRS, toCRS) == true; }
public TaskParameter Transform(ITransformation transformation) { if (transformation == null) throw new NullReferenceException("The transformation argument was null."); Transformations.Add(transformation); return this; }
public static bool NeedsTransform(ITransformation transformation, string fromCRS, string toCRS) { return (transformation != null && !string.IsNullOrWhiteSpace(fromCRS) && !string.IsNullOrWhiteSpace(toCRS) && fromCRS != toCRS); }
private void TransformEntry(LogEntry entry, ITransformation[] transformations) { foreach (ITransformation transformation in transformations) { if (transformation == null) continue; transformation.Apply(entry); } }
public TransformingWrapperPackageFile(IPackageFile packageFile, ITransformation transformation) { this.packageFile = packageFile; this.transformation = transformation; }
public TransformingWrapperPackageEntry(IPackageEntry packageEntry, ITransformation transformation) { this.packageEntry = packageEntry; this.transformation = transformation; }
/// <summary> /// Private Constructor /// </summary> private TransformAgent() { _data = new TransformData(); }
public TradingAccountWrapper(RequestContext context) : base(context, SupportedResourceKinds.tradingAccounts) { _entity = new Account(); _transformation = TransformationFactory.GetTransformation<ITransformation<AccountDocument, TradingAccountPayload>>(SupportedResourceKinds.tradingAccounts, context); }