public GenerateInstallScriptRequestProcessor( IPath path, IHelpContentManager helpContentManager) { _path = path; _helpContentManager = helpContentManager; }
public Record(IPath path) { _time = path.Time; _position = path.Position; _velocity = path.Velocity; _acceleration = path.Acceleration; }
internal SubOperation(MouseArea mc, IPath path) { this.currentGraph = null; this.mouseAreaControl = null; this.mouseAreaControl = mc; this.CurrentGraph = path; }
internal static IFilePath GetSisterFilePath(IPath path, string fileName) { Argument.IsNotNull(nameof(path), path); Argument.IsNotNullOrEmpty(nameof(fileName), fileName); return path.ParentDirectoryPath.GetChildFilePath(fileName); }
internal static IDirectoryPath GetSisterDirectoryPath(IPath path, string directoryName) { Argument.IsNotNull(nameof(path), path); Argument.IsNotNullOrEmpty(nameof(directoryName), directoryName); return path.ParentDirectoryPath.GetChildDirectoryPath(directoryName); }
internal static IDirectoryPath GetBrotherDirectoryWithName(IPath path, string directoryName) { Debug.Assert(path != null); Debug.Assert(directoryName != null); // Enforced by contract Debug.Assert(directoryName.Length > 0); // Enforced by contract return path.ParentDirectoryPath.GetChildDirectoryWithName(directoryName); }
// Methods public BezierOperation(MouseArea mc) { this.mouseAreaControl = null; this.currentGraph = null; this.revertMatrix = new Matrix(); this.startPoint = PointF.Empty; this.currentOperate = BezierOperate.Draw; this.activePoints = new PointInfoCollection(); this.editPath = new GraphicsPath(); this.preInfo = null; this.reversePath = new GraphicsPath(); this.editpath = new GraphicsPath(); this.preDrawInfo = null; this.starttrend = PointF.Empty; this.endtrend = PointF.Empty; this.addInfo = null; this.moveinfo = null; this.movePoint = PointF.Empty; this.currentinfo = null; this.SubpathList = new Hashtable(0x10); this.oldstr = string.Empty; this.attributename = string.Empty; this.showcontrol = true; this.activeindex = new int[0]; this.oldindex = -1; this.centerPoint = PointF.Empty; this.incenter = false; this.tooltips = new Hashtable(0x10); this.mouseAreaControl = mc; this.win32 = mc.win32; this.mouseAreaControl.DefaultCursor = SpecialCursors.bezierCursor; }
public LinearPath(IPath anotherPath, int sampleCount) { List<Vector3> pointList = new List<Vector3>(1000); PathPosition pathPosition = anotherPath.getStartPoint(); float pathLength = 0f; float remaining = 0f; while (remaining == 0) { remaining = anotherPath.move(pathPosition, 0.01f, out pathPosition); pathLength += 0.01f; } pathLength -= remaining; distanceBetweenPoints = pathLength / sampleCount; pathPosition = anotherPath.getStartPoint(); remaining = 0; while (remaining == 0f) { pointList.Add(anotherPath.getLocalPosition(pathPosition)); remaining = anotherPath.move(pathPosition, distanceBetweenPoints, out pathPosition); } if (remaining < distanceBetweenPoints / 2f) pointList[pointList.Count - 1] = anotherPath.getLocalPosition(anotherPath.getEndPoint()); else pointList.Add(anotherPath.getLocalPosition(anotherPath.getEndPoint())); points = pointList.ToArray(); }
internal static IFilePath GetBrotherFileWithName(IPath path, string fileName) { Debug.Assert(path != null); Debug.Assert(fileName != null); // Enforced by contract Debug.Assert(fileName.Length > 0); // Enforced by contract return path.ParentDirectoryPath.GetChildFileWithName(fileName); }
/// <summary> /// Gets a default behavior for a path segment /// </summary> /// <param name="location"></param> /// <param name="vehicleState"></param> /// <param name="exit"></param> /// <param name="relative"></param> /// <param name="stopSpeed"></param> /// <param name="aMax"></param> /// <param name="dt">timestep in seconds</param> /// <returns></returns> public static PathFollowingBehavior DefaultStayInLaneBehavior(RndfLocation location, VehicleState vehicleState, RndfWaypointID action, ActionType actionType, bool relative, double stopSpeed, double aMax, double dt, double maxSpeed, IPath path) { // get lane path //IPath path = RoadToolkit.LanePath(location.Partition.FinalWaypoint.Lane, vehicleState, relative); // check if the action is just a goal (note that exit and stop take precedence) if (actionType == ActionType.Goal) { // get maximum speed //double maxSpeed = location.Partition.FinalWaypoint.Lane.Way.Segment.SpeedInformation.MaxSpeed; //double maxSpeed = maxV; // generate path following behavior //return new PathFollowingBehavior(path, new ScalarSpeedCommand(maxSpeed)); return null; } else { // get maximum speed //double maxSpeed = location.Partition.FinalWaypoint.Lane.Way.Segment.SpeedInformation.MaxSpeed; // get operational required distance to hand over to operational stop double distance = RoadToolkit.DistanceUntilOperationalStop(RoadToolkit.DistanceToWaypoint(location, action)-TahoeParams.FL); // get desired velocity double desiredSpeed = RoadToolkit.InferFinalSpeed(0, stopSpeed, distance, maxSpeed, aMax, dt); // generate path following behavior //return new PathFollowingBehavior(path, new ScalarSpeedCommand(desiredSpeed)); return null; } }
/// <summary> /// Initializes a new instance of the <see cref="SelfMediaDatabase.Core.Operations.Prune.PruneOperation"/> class. /// </summary> /// <param name="directory">Injection wrapper of <see cref="System.IO.Directory"/>.</param> /// <param name="file">Injection wrapper of <see cref="System.IO.File"/>.</param> /// <param name="path">Injection wrapper of <see cref="System.IO.Path"/>.</param> /// <param name="imageComparer">Image comparer.</param> /// <param name="fileSystemHelper">Helper to access to files.</param> public PruneOperation( IDirectory directory, IFile file, IPath path, IImageComparer imageComparer, IFileSystemHelper fileSystemHelper, IDialog dialog, IRenameOperation renameOperation) { if (directory == null) throw new ArgumentNullException("directory"); if (file == null) throw new ArgumentNullException("file"); if (imageComparer == null) throw new ArgumentNullException("imageComparer"); if (fileSystemHelper == null) throw new ArgumentNullException("fileSystemHelper"); if (path == null) throw new ArgumentNullException("path"); if (dialog == null) throw new ArgumentNullException("dialog"); if (renameOperation == null) throw new ArgumentNullException("renameOperation"); _directory = directory; _file = file; _path = path; _imageComparer = imageComparer; _fileSystemHelper = fileSystemHelper; _dialog = dialog; _renameOperation = renameOperation; }
/// <summary> /// Creates a new instance of the axis class /// </summary> /// <param name="path">That path to use</param> public Axis(IPath path) { _valid = true; _path = path; SetPath(path); }
public SelectableObject(Guid owner ,string name, IPath path) { m_Owner = owner; m_Bounds = new Box(20.0, 20.0); m_Name = name; m_Path = path; }
private void ChangeUnitLocation(IPath pathToTheTargetPlanet, IUnit unitToTeleport, ILocation targetLocation) { pathToTheTargetPlanet.TargetLocation.Planet.Units.Add(unitToTeleport); unitToTeleport.CurrentLocation.Planet.Units.Remove(unitToTeleport); unitToTeleport.PreviousLocation = unitToTeleport.CurrentLocation; unitToTeleport.CurrentLocation = targetLocation; }
public bool Matches(IRoute route, IPath path) { var routePath = route.Path; if (!routePath.IsLiteral) return false; return routePath.LiteralPath.Equals(path.LiteralPath); }
public static List<Vector2> IPathToPoints(IPath p) { List<Vector2> pts = new List<Vector2>(); foreach (IPathSegment lp in p) pts.Add(lp.Start); pts.Add(p.EndPoint.pt); return pts; }
/// <summary> /// Initializes a new instance of the <see cref="X509CertificateWrap"/> class. /// </summary> public X509CertificateWrap(IFile file, IPath path) { this.FileWrap = file; this.PathWrap = path; this.Initialize(); }
/// <summary> /// Creates a new instance of the axis class /// </summary> /// <param name="converter">The converter to use</param> public Axis(IConverter converter) { _valid = true; _path = new Path(converter); _converter = converter; SetPath(_path); }
public RRTPlannerImpl(RobotTwoWheelStateProvider stateProvider) { rrt = new RRTPlannerControl(); obstacles = new List<Polygon>(); currentPose = new RobotPose(); waypoints = new PointPath(); this.stateProvider = stateProvider; }
public void Test_ContainsPath() { var array = new IPath[] { @"C:\File.txt".ToAbsoluteFilePath(), @".\".ToRelativeDirectoryPath() }; Assert.IsTrue(array.ContainsPath(@".\".ToRelativeDirectoryPath())); Assert.IsFalse(array.ContainsPath(@"..\".ToRelativeDirectoryPath())); }
/// <summary> /// Returns <i>true</i> if <paramref name="path" /> and <paramref name="otherPath" /> are both <i>null</i>, or if <paramref name="path" />.Equals( /// <paramref name="otherPath" />). /// </summary> /// <param name="path">The first path.</param> /// <param name="otherPath">The scond path.</param> public static bool EqualsNullSupported(this IPath path, IPath otherPath) { if (path == null) { return otherPath == null; } return otherPath != null && path.Equals(otherPath); }
public void UpdatePath(IPath path) { if (path == null) return; if (PathUtils.CheckPathsEqual(this.path, path)) return; lock (pathLock) { this.path = path; } }
/// <summary> /// Create a new instance of the axis class with the path being created from the converter /// </summary> /// <param name="path">This parameter is ignored</param> /// <param name="converter">The converter to use</param> public Axis(IPath path, IConverter converter) { _valid = true; _path = path; _converter = converter; _path = new Path(converter); SetPath(new Path(converter)); }
public void BecauseOf() { m_Path = Get<IPath>(); m_Motion = Get<IMotion>(); m_Path.GetCurrentMotion(Arg.Any<ulong>()).Returns(m_Motion); m_SelectableObject = new SelectableObject(m_TestObjectName, m_Path); }
public InstallationFileManager(IBaseDir baseDir) { _baseDir = baseDir; _moduleInstallationPath = new CommonPath() { PhysicalPath = Path.Combine(_baseDir.Cms_DataPhysicalPath, "ModuleInstallations"), VirtualPath = Kooboo.Web.Url.UrlUtility.Combine(_baseDir.Cms_DataVirtualPath, "ModuleInstallations") }; if (!Directory.Exists(_moduleInstallationPath.PhysicalPath)) { Directory.CreateDirectory(_moduleInstallationPath.PhysicalPath); } }
public void Initialize() { _file = Substitute.For<IFile>(); _directory = Substitute.For<IDirectory>(); _path = Substitute.For<IPath>(); _path.SetPathDefaultBehavior(); _fileSystemHelper = Substitute.For<IFileSystemHelper>(); _target = new FileOutput(_file, _directory, _path, _fileSystemHelper); }
public Installer(IPath installerDirectory, IPath manifestFile, IPath configFile) { this.InstallerDirectory = installerDirectory.AbsolutePath; this.ResourcesDirectory = this.InstallerDirectory + "\\" + PackageBuilder.ResourcesArchivePath; JsonFileHandler<ScriptManifest> manifestHandler = new JsonFileHandler<ScriptManifest>(); this.Manifest = manifestHandler.Read(manifestFile); JsonFileHandler<InstallerConfiguration> configHandler = new JsonFileHandler<InstallerConfiguration>(); this.Configuration = configHandler.Read(configFile); }
public Boolean IsEntireLinePathClear(IPath p, List<Polygon> obstacles) { foreach (IPathSegment seg in p) { if (seg is LinePathSegment == false) return false; LinePathSegment lseg = seg as LinePathSegment; if (IsLineSegmentClear(lseg, obstacles) == false) return false; } return true; }
public RobotPathMessage(int robotID, IPath path) { this.path = path; this.robotID = robotID; if (path.Count > 0) { this.goalPointOnPath = path[0].StartPoint; this.robotPointOnPath = path[0].StartPoint; } }
/// <summary> /// Removes the second path from the first. E.g., Exclude("c:\users\foo\bar", "c:\users") would /// return "foo\bar". /// </summary> /// <param name="FirstPathObject"></param> /// <param name="SecondPathObject"></param> /// <returns></returns> public IPath Exclude(IPath SecondPathObject) { string SecondPath = SecondPathObject.ToString(); if (!Path.StartsWith(SecondPath)) { return null; } return new Win32Path(Path.Remove(0, SecondPath.Length)); }
public static System.Int64 SE_GenerateGeometry(SE_SHAPE_64 shape, IGeometry geometry, SE_ENVELOPE maxExtent) { if (geometry == null) { return(-1); } unsafe { SE_POINT * points = null; System.Int32 *parts = null; switch (geometry.GeometryType) { case geometryType.Envelope: SE_ENVELOPE seEnvelope = new SE_ENVELOPE(); IEnvelope env = geometry.Envelope; seEnvelope.minx = Math.Max(env.minx, maxExtent.minx); seEnvelope.miny = Math.Max(env.miny, maxExtent.miny); seEnvelope.maxx = Math.Min(env.maxx, maxExtent.maxx); seEnvelope.maxy = Math.Min(env.maxy, maxExtent.maxy); if (seEnvelope.minx == seEnvelope.maxx && seEnvelope.miny == seEnvelope.maxy) { /* fudge a rectangle so we have a valid one for generate_rectangle */ /* FIXME: use the real shape for the query and set the filter_type * to be an appropriate type */ seEnvelope.minx = seEnvelope.minx - 0.001; seEnvelope.maxx = seEnvelope.maxx + 0.001; seEnvelope.miny = seEnvelope.miny - 0.001; seEnvelope.maxy = seEnvelope.maxy + 0.001; } return(Wrapper92_64.SE_shape_generate_rectangle(ref seEnvelope, shape)); case geometryType.Point: points = (SE_POINT *)Marshal.AllocHGlobal(sizeof(SE_POINT) * 1); points[0].x = ((IPoint)geometry).X; points[0].y = ((IPoint)geometry).Y; return(Wrapper92_64.SE_shape_generate_point(1, (IntPtr)points, (IntPtr)null, (IntPtr)null, shape)); case geometryType.Polyline: IPointCollection col1 = gView.Framework.SpatialAlgorithms.Algorithm.GeometryPoints(geometry, false); IPolyline polyline = (IPolyline)geometry; points = (SE_POINT *)Marshal.AllocHGlobal(sizeof(SE_POINT) * (col1.PointCount)); parts = (Int32 *)Marshal.AllocHGlobal(sizeof(Int32) * polyline.PathCount); int pos1 = 0; for (int i = 0; i < polyline.PathCount; i++) { parts[i] = pos1; IPath path = polyline[i]; if (path.PointCount == 0) { continue; } for (int p = 0; p < path.PointCount; p++) { points[pos1].x = path[p].X; points[pos1].y = path[p].Y; pos1++; } } return(Wrapper92_64.SE_shape_generate_line(pos1, polyline.PathCount, (IntPtr)parts, (IntPtr)points, (IntPtr)null, (IntPtr)null, shape)); case geometryType.Polygon: IPointCollection col2 = gView.Framework.SpatialAlgorithms.Algorithm.GeometryPoints(geometry, false); IPolygon polygon = (IPolygon)geometry; points = (SE_POINT *)Marshal.AllocHGlobal(sizeof(SE_POINT) * (col2.PointCount + polygon.RingCount)); parts = (Int32 *)Marshal.AllocHGlobal(sizeof(Int32) * polygon.RingCount); int pos2 = 0; for (int i = 0; i < polygon.RingCount; i++) { parts[i] = pos2; IRing ring = polygon[i]; if (ring.PointCount == 0) { continue; } for (int p = 0; p < ring.PointCount; p++) { points[pos2].x = ring[p].X; points[pos2].y = ring[p].Y; pos2++; } points[pos2].x = ring[0].X; points[pos2].y = ring[0].Y; pos2++; } return(Wrapper92_64.SE_shape_generate_polygon(pos2, polygon.RingCount, (IntPtr)parts, (IntPtr)points, (IntPtr)null, (IntPtr)null, shape)); case geometryType.Aggregate: if (((AggregateGeometry)geometry).GeometryCount == 1) { return(SE_GenerateGeometry(shape, ((AggregateGeometry)geometry)[0], maxExtent)); } //else //{ // Polygon polygon = new Polygon(); // for (int i = 0; i < ((AggregateGeometry)geometry).GeometryCount; i++) // { // IGeometry g = ((AggregateGeometry)geometry)[i]; // if (g is IPolygon) // { // for (int p = 0; p < ((IPolygon)g).RingCount; p++) // polygon.AddRing(((Polygon)g)[p]); // } // } // if (polygon.RingCount > 0) return SE_GenerateGeometry(shape, polygon, maxExtent); //} return(-1); } } return(-1); }
public WalkerWrapper(IPath walker) { this.walker = walker; }
public BezierSpline(IPath firstSegment) { AddPath(firstSegment); }
/// <summary> /// 分析资源 /// </summary> /// <param name="paths"></param> /// <param name="target"></param> /// <param name="outpath"></param> private static void AnalyzeResource(string[] paths, BuildTarget target, string outpath) { curManifestConfig = new ManifestConfig(); //加载存在的配置 ManifestConfig lastManifestConfig = null; var lastConfigPath = IPath.Combine(outpath, "Art/Config.json"); if (File.Exists(lastConfigPath)) { lastManifestConfig = new ManifestConfig(File.ReadAllText(lastConfigPath)); } else { lastManifestConfig = new ManifestConfig(); } List <string> changeList = new List <string>(); float curIndex = 0; foreach (var path in paths) { var _path = path.Replace("\\", "/"); EditorUtility.DisplayProgressBar("分析资源 -" + target.ToString(), "分析:" + Path.GetFileNameWithoutExtension(_path) + " 进度:" + curIndex + "/" + paths.Length, curIndex / paths.Length); curIndex++; //获取被依赖的路径 var dependsource = "Assets" + _path.Replace(Application.dataPath, ""); var allDependObjectPaths = AssetDatabase.GetDependencies(dependsource).ToList(); var UIID = GetMD5HashFromFile(_path); if (string.IsNullOrEmpty(UIID)) { continue; } List <string> dependAssets = new List <string>(); //处理依赖资源是否打包 for (int i = 0; i < allDependObjectPaths.Count; i++) { // var dependPath = allDependObjectPaths[i]; //脚本不打包 var ext = Path.GetExtension(dependPath).ToLower(); if (ext == ".cs" || ext == ".js") { continue; } // AssetImporter ai = AssetImporter.GetAtPath(dependPath); if (ai == null) { BDebug.Log("not find Resource " + dependPath); continue; } var dependObjPath = Application.dataPath + dependPath.TrimStart("Assets".ToCharArray()); var uiid = GetMD5HashFromFile(dependObjPath); if (string.IsNullOrEmpty(uiid)) { continue; } string abname = "assets" + dependObjPath.Replace(Application.dataPath, "").ToLower(); ManifestItem manifestItem = null; lastManifestConfig.Manifest.TryGetValue(abname, out manifestItem); //last没有或者 uiid不一致被改动, if (manifestItem == null || manifestItem.UIID != uiid) { ai.assetBundleName = abname; ai.assetBundleVariant = ""; changeList.Add(abname); } else { ai.assetBundleName = null; } //被依赖的文件,不保存其依赖信息 if (abname != dependsource.ToLower()) //依赖列表中会包含自己 { curManifestConfig.AddDepend(abname, uiid, new List <string>()); } dependAssets.Add(abname); } //保存主文件的依赖 if (dependAssets.Count > 0) { dependAssets.Remove(dependsource.ToLower()); curManifestConfig.AddDepend(dependsource.ToLower(), UIID, dependAssets); } } EditorUtility.ClearProgressBar(); Debug.Log("本地需要打包资源:" + changeList.Count); }
public abstract int CompareTo(IPath <T> arg1);
/// <summary> /// Gets the first vertex in the specified path. This is either the source /// of the first edge or, if there are no edges yet, the given destination. /// </summary> /// <param name="path">The path to search.</param> /// <param name="dst">The destination to search.</param> /// <returns>The first vertex found, otherwise returns the given destination vertex.</returns> private static V GetFirstVertex(IPath <V, E> path, V dst) => path.Edges.Count is 0 ? dst : path.Edges[0].Src;
/// <summary> /// Determines whether or not the specified edge source is already visited in the specified path. /// </summary> /// <param name="edge">The edge to test.</param> /// <param name="path">The path to test.</param> /// <returns>True if the edge's source is a vertex in the path already.</returns> private static bool IsInPath(E edge, IPath <V, E> path) => path.Edges.Any(e => edge.Src.Equals(e.Dst));
public abstract bool IsBetter(IPath <T> arg1);
/// <summary> /// 打包APK /// </summary> static public void BuildAPK(BuildMode mode) { if (!BDEditorApplication.BdFrameEditorSetting.IsSetConfig()) { Debug.LogError("请注意设置apk keystore账号密码"); return; } var absroot = Application.dataPath.Replace("Assets", ""); PlayerSettings.Android.keystoreName = absroot + BDEditorApplication.BdFrameEditorSetting.Android.keystoreName; PlayerSettings.keystorePass = BDEditorApplication.BdFrameEditorSetting.Android.keystorePass; PlayerSettings.Android.keyaliasName = BDEditorApplication.BdFrameEditorSetting.Android.keyaliasName; PlayerSettings.keyaliasPass = BDEditorApplication.BdFrameEditorSetting.Android.keyaliasPass; //具体安卓的配置 PlayerSettings.gcIncremental = true; PlayerSettings.stripEngineCode = true; PlayerSettings.Android.preferredInstallLocation = AndroidPreferredInstallLocation.Auto; // var outdir = BDApplication.ProjectRoot + "/Build"; var outputPath = IPath.Combine(outdir, string.Format("{0}_{1}.apk", Application.productName, mode.ToString())); //文件夹处理 if (!Directory.Exists(outdir)) { Directory.CreateDirectory(outdir); } if (File.Exists(outputPath)) { File.Delete(outputPath); } //清空StreamingAsset var ios = IPath.Combine(Application.streamingAssetsPath, "iOS"); if (Directory.Exists(ios)) { Directory.Delete(ios, true); } var win = IPath.Combine(Application.streamingAssetsPath, "Windows"); if (Directory.Exists(win)) { Directory.Delete(win, true); } //开始项目一键打包 string[] scenes = { SCENEPATH }; BuildOptions opa = BuildOptions.None; if (mode == BuildMode.Debug) { opa = BuildOptions.CompressWithLz4HC | BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.ConnectWithProfiler | BuildOptions.EnableDeepProfilingSupport; } else if (mode == BuildMode.Release) { opa = BuildOptions.CompressWithLz4HC; } UnityEditor.BuildPipeline.BuildPlayer(scenes, outputPath, BuildTarget.Android, opa); if (File.Exists(outputPath)) { Debug.Log("Build Success :" + outputPath); EditorUtility.RevealInFinder(outputPath); } else { Debug.LogError(new Exception("Build Fail! Please Check the log! ")); } }
public void Draw(IDisplay disp, IFeature feature) { #region Check Values if (_symbolTable.Keys.Count == 0) { return; } double[] values = new double[_symbolTable.Keys.Count]; double valSum = 0.0, valMax = double.MinValue, valMin = double.MaxValue; #region Get Values int i = 0; foreach (string fieldname in _symbolTable.Keys) { object val = feature[fieldname]; if (val == null || val == System.DBNull.Value) { return; } try { values[i++] = Convert.ToDouble(val); valSum += Math.Abs(values[i - 1]); valMax = Math.Max(valMax, values[i - 1]); valMin = Math.Min(valMin, values[i - 1]); } catch { return; } } #endregion #endregion IPoint point = null; if (feature.Shape is IPoint) { point = (IPoint)feature.Shape; if (disp.LabelEngine.TryAppend(disp, ChartAnnotationPolygon(disp, point, values, valSum, valMin, valMax), feature.Shape, _labelPriority != SimpleLabelRenderer.labelPriority.always) == LabelAppendResult.Succeeded) { DrawChart(disp, point, values, valSum, valMin, valMax); } } else if (feature.Shape is IPolyline) { IEnvelope dispEnv = _clipEnvelope; IPolyline pLine = (IPolyline)gView.Framework.SpatialAlgorithms.Clip.PerformClip(dispEnv, feature.Shape); if (pLine == null) { return; } for (int iPath = 0; iPath < pLine.PathCount; iPath++) { IPath path = pLine[iPath]; for (int iPoint = 0; iPoint < path.PointCount - 1; iPoint++) { IPoint p1 = path[iPoint]; IPoint p2 = path[iPoint + 1]; if (dispEnv.minx <= p1.X && dispEnv.maxx >= p1.X && dispEnv.miny <= p1.Y && dispEnv.maxy >= p1.Y && dispEnv.minx <= p2.X && dispEnv.maxx >= p2.X && dispEnv.miny <= p2.Y && dispEnv.maxy >= p2.Y) { point = new Point((p1.X + p2.X) * 0.5, (p1.Y + p2.Y) * 0.5); if (disp.LabelEngine.TryAppend(disp, ChartAnnotationPolygon(disp, point, values, valSum, valMin, valMax), pLine, _labelPriority != SimpleLabelRenderer.labelPriority.always) == LabelAppendResult.Succeeded) { DrawChart(disp, point, values, valSum, valMin, valMax); return; } } } } } else if (feature.Shape is IPolygon) { LabelPolygon(disp, (IPolygon)feature.Shape, values, valSum, valMin, valMax); } }
public static IGeometry GetGeometry2D(ShapeLib.SHPObject obj) { if (obj == null) { return(null); } int parts = obj.nParts; int verts = obj.nVertices; int part = 0, nextp = 0; double[] X = new double[verts]; double[] Y = new double[verts]; int[] pStart = new int[parts]; unsafe { int *pstart = (int *)obj.paPartStart.ToPointer(); //ShapeLib.PartType * pType =(ShapeLib.PartType *)obj.paPartType.ToPointer(); double *x = (double *)obj.padfX; double *y = (double *)obj.padfY; for (int i = 0; i < verts; i++) { X[i] = x[i]; Y[i] = y[i]; } for (int i = 0; i < parts; i++) { pStart[i] = pstart[i]; } } switch (obj.shpType) { case ShapeLib.ShapeType.Point: case ShapeLib.ShapeType.PointM: case ShapeLib.ShapeType.PointZ: return(new Point(X[0], Y[0])); case ShapeLib.ShapeType.PolyLine: case ShapeLib.ShapeType.PolyLineM: case ShapeLib.ShapeType.PolyLineZ: IPolyline polyline = new Polyline(); IPath path = null; for (int v = 0; v < verts; v++) { if (path != null && nextp == v) { polyline.AddPath(path); path = null; } if (path == null) { if (parts <= part + 1) { nextp = verts; } else { nextp = pStart[part + 1]; part++; } path = new gView.Framework.Geometry.Path(); } path.AddPoint(new Point(X[v], Y[v])); } polyline.AddPath(path); X = Y = null; return(polyline); case ShapeLib.ShapeType.Polygon: case ShapeLib.ShapeType.PolygonM: case ShapeLib.ShapeType.PolygonZ: IPolygon polygon = new Polygon(); IRing ring = null; for (int v = 0; v < verts; v++) { if (ring != null && nextp == v) { polygon.AddRing(ring); ring = null; } if (ring == null) { if (parts <= part + 1) { nextp = verts; } else { nextp = pStart[part + 1]; part++; } ring = new Ring(); } ring.AddPoint(new Point(X[v], Y[v])); } polygon.AddRing(ring); X = Y = null; return(polygon); } return(null); }
private Buffer2D <float> Render(IPath path) { Size size = Rectangle.Ceiling(path.Bounds).Size; size = new Size(size.Width + (this.offset * 2), size.Height + (this.offset * 2)); float subpixelCount = 4; float offset = 0.5f; if (this.Options.Antialias) { offset = 0f; // we are antialising skip offsetting as real antalising should take care of offset. subpixelCount = this.Options.AntialiasSubpixelDepth; if (subpixelCount < 4) { subpixelCount = 4; } } // take the path inside the path builder, scan thing and generate a Buffer2d representing the glyph and cache it. Buffer2D <float> fullBuffer = this.MemoryAllocator.Allocate2D <float>(size.Width + 1, size.Height + 1, AllocationOptions.Clean); using (IMemoryOwner <float> bufferBacking = this.MemoryAllocator.Allocate <float>(path.MaxIntersections)) using (IMemoryOwner <PointF> rowIntersectionBuffer = this.MemoryAllocator.Allocate <PointF>(size.Width)) { float subpixelFraction = 1f / subpixelCount; float subpixelFractionPoint = subpixelFraction / subpixelCount; for (int y = 0; y <= size.Height; y++) { Span <float> scanline = fullBuffer.GetRowSpan(y); bool scanlineDirty = false; float yPlusOne = y + 1; for (float subPixel = (float)y; subPixel < yPlusOne; subPixel += subpixelFraction) { var start = new PointF(path.Bounds.Left - 1, subPixel); var end = new PointF(path.Bounds.Right + 1, subPixel); Span <PointF> intersectionSpan = rowIntersectionBuffer.GetSpan(); Span <float> buffer = bufferBacking.GetSpan(); int pointsFound = path.FindIntersections(start, end, intersectionSpan); if (pointsFound == 0) { // nothing on this line skip continue; } for (int i = 0; i < pointsFound && i < intersectionSpan.Length; i++) { buffer[i] = intersectionSpan[i].X; } QuickSort.Sort(buffer.Slice(0, pointsFound)); for (int point = 0; point < pointsFound; point += 2) { // points will be paired up float scanStart = buffer[point]; float scanEnd = buffer[point + 1]; int startX = (int)MathF.Floor(scanStart + offset); int endX = (int)MathF.Floor(scanEnd + offset); if (startX >= 0 && startX < scanline.Length) { for (float x = scanStart; x < startX + 1; x += subpixelFraction) { scanline[startX] += subpixelFractionPoint; scanlineDirty = true; } } if (endX >= 0 && endX < scanline.Length) { for (float x = endX; x < scanEnd; x += subpixelFraction) { scanline[endX] += subpixelFractionPoint; scanlineDirty = true; } } int nextX = startX + 1; endX = Math.Min(endX, scanline.Length); // reduce to end to the right edge nextX = Math.Max(nextX, 0); for (int x = nextX; x < endX; x++) { scanline[x] += subpixelFraction; scanlineDirty = true; } } } if (scanlineDirty) { if (!this.Options.Antialias) { for (int x = 0; x < size.Width; x++) { if (scanline[x] >= 0.5) { scanline[x] = 1; } else { scanline[x] = 0; } } } } } } return(fullBuffer); }
/// <summary> /// Clips the specified holes. /// </summary> /// <param name="shape">The shape.</param> /// <param name="holes">The holes.</param> /// <returns>Returns a new shape with the holes cliped out out the shape.</returns> public static IPath Clip(this IPath shape, params IPath[] holes) => shape.Clip((IEnumerable <IPath>)holes);
/// <summary> /// Generates a outline of the path with alternating on and off segments based on the pattern. /// </summary> /// <param name="path">the path to outline</param> /// <param name="width">The final width outline</param> /// <param name="pattern">The pattern made of multiples of the width.</param> /// <param name="startOff">Weather the first item in the pattern is on or off.</param> /// <param name="jointStyle">The style to render the joints.</param> /// <param name="patternSectionCapStyle">The style to render between sections of the specified pattern.</param> /// <returns>A new path representing the outline.</returns> public static IPath GenerateOutline(this IPath path, float width, ReadOnlySpan <float> pattern, bool startOff, JointStyle jointStyle = JointStyle.Square, EndCapStyle patternSectionCapStyle = EndCapStyle.Butt) { if (pattern.Length < 2) { return(path.GenerateOutline(width, jointStyle: jointStyle)); } JoinType style = Convert(jointStyle); EndType patternSectionCap = Convert(patternSectionCapStyle); IEnumerable <ISimplePath> paths = path.Flatten(); var offset = new ClipperOffset() { MiterLimit = MiterOffsetDelta }; var buffer = new List <IntPoint>(3); foreach (ISimplePath p in paths) { bool online = !startOff; float targetLength = pattern[0] * width; int patternPos = 0; ReadOnlySpan <PointF> points = p.Points.Span; // Create a new list of points representing the new outline int pCount = points.Length; if (!p.IsClosed) { pCount--; } int i = 0; Vector2 currentPoint = points[0]; while (i < pCount) { int next = (i + 1) % points.Length; Vector2 targetPoint = points[next]; float distToNext = Vector2.Distance(currentPoint, targetPoint); if (distToNext > targetLength) { // find a point between the 2 float t = targetLength / distToNext; Vector2 point = (currentPoint * (1 - t)) + (targetPoint * t); buffer.Add(currentPoint.ToPoint()); buffer.Add(point.ToPoint()); // we now inset a line joining if (online) { offset.AddPath(buffer, style, patternSectionCap); } online = !online; buffer.Clear(); currentPoint = point; // next length patternPos = (patternPos + 1) % pattern.Length; targetLength = pattern[patternPos] * width; } else if (distToNext <= targetLength) { buffer.Add(currentPoint.ToPoint()); currentPoint = targetPoint; i++; targetLength -= distToNext; } } if (buffer.Count > 0) { if (p.IsClosed) { buffer.Add(points[0].ToPoint()); } else { buffer.Add(points[points.Length - 1].ToPoint()); } if (online) { offset.AddPath(buffer, style, patternSectionCap); } online = !online; buffer.Clear(); patternPos = (patternPos + 1) % pattern.Length; targetLength = pattern[patternPos] * width; } } return(ExecuteOutliner(width, offset)); }
public string PathRoute(IPath path) { path.Next(); return(path.Current.Raw); }
/// <summary> /// Generates a outline of the path with alternating on and off segments based on the pattern. /// </summary> /// <param name="path">the path to outline</param> /// <param name="width">The final width outline</param> /// <param name="pattern">The pattern made of multiples of the width.</param> /// <returns>A new path representing the outline.</returns> public static IPath GenerateOutline(this IPath path, float width, ReadOnlySpan <float> pattern) { return(path.GenerateOutline(width, pattern, false)); }
//只允许处理/uploadfiles/user/目录下的图片 private string GetImgPath(string url) { return(SafeSC.PathDeal("/UploadFiles/User/" + IPath.ToLower().Replace("/uploadfiles/user/", ""))); }
/// <summary> /// Initializes a new instance of the <see cref="ShapePath"/> class. /// </summary> /// <param name="shape">The shape.</param> /// <param name="pen">The pen to apply to the shape.</param> // SixLabors.shape willbe moving to a Span/ReadOnlySpan based API shortly use ToArray for now. public ShapePath(IPath shape, Pens.IPen pen) : base(shape.GenerateOutline(pen.StrokeWidth, pen.StrokePattern.ToArray())) { }
private void Test_Paths_Draw(IPath path) { ((IDrawingWand)path).Draw(null); }
/// <summary> /// Flood fills the image in the shape of the provided polygon with the specified brush. /// </summary> /// <typeparam name="TColor">The type of the color.</typeparam> /// <param name="source">The image this method extends.</param> /// <param name="brush">The brush.</param> /// <param name="path">The path.</param> /// <returns>The <see cref="Image{TColor}"/>.</returns> public static Image <TColor> Fill <TColor>(this Image <TColor> source, IBrush <TColor> brush, IPath path) where TColor : struct, IPackedPixel, IEquatable <TColor> { return(source.Fill(brush, new ShapeRegion(path), GraphicsOptions.Default)); }
/// <summary> /// Flood fills the image in the shape of the provided polygon with the specified brush.. /// </summary> /// <typeparam name="TColor">The type of the color.</typeparam> /// <param name="source">The image this method extends.</param> /// <param name="color">The color.</param> /// <param name="path">The path.</param> /// <returns>The <see cref="Image{TColor}"/>.</returns> public static Image <TColor> Fill <TColor>(this Image <TColor> source, TColor color, IPath path) where TColor : struct, IPackedPixel, IEquatable <TColor> { return(source.Fill(new SolidBrush <TColor>(color), path)); }
/// <summary> /// Generates a outline of the path with alternating on and off segments based on the pattern. /// </summary> /// <param name="path">the path to outline</param> /// <param name="width">The final width outline</param> /// <param name="pattern">The pattern made of multiples of the width.</param> /// <param name="startOff">Weather the first item in the pattern is on or off.</param> /// <returns>A new path representing the outline.</returns> public static IPath GenerateOutline(this IPath path, float width, ReadOnlySpan <float> pattern, bool startOff) => GenerateOutline(path, width, pattern, startOff, JointStyle.Square, EndCapStyle.Butt);
/// <summary> /// 同步加载指定类型的asset /// needCheckPath: true时会根据_isFirstUseStreamingAssets判断是否要转成assetbundle下的目录 /// </summary> public T loadAsset <T>(string strPath, bool needCheckPath = true) where T : Object { string asset_name = GetNameFromPath(strPath); strPath = strPath.ToLower(); strPath = strPath.Replace("\\", "/"); if (AssetManager.getInstance().IsStreamingAssets(strPath)) { if (needCheckPath) { strPath = UtilTools.PathCheck(strPath); } } Object obj = null; if (_dictAssetBundles.ContainsKey(strPath))//判断缓存中是否有 { AssetBundle bundle = _dictAssetBundles[strPath] as AssetBundle; if (bundle != null) { obj = bundle.LoadAsset <Object>(asset_name); //引用计数+1 //_dictAssetbundlesRefCount[strPath]++; } else { obj = _dictAssetBundles[strPath]; //引用计数+1 //_dictAssetbundlesRefCount[strPath]++; } } else//没有再去同步加载 { Utils.LogSys.Log("AssetManager Get Path Data 2"); string strLatesVersionpath = _objPathData.getLatestVersionPath(strPath); EAssetPathType eType = _objPathData.getAssetPathType(strPath); LogSys.Log("[AssetManager.LoadAesst]:+" + strLatesVersionpath + " eType = " + eType); if (eType == EAssetPathType.ePersistent) { if (File.Exists(strLatesVersionpath)) { string[] objDepRec = AssetManager.getInstance().getAssetBundleDependencies(strPath); for (int i = 0; i < objDepRec.Length; i++) { loadAsset <Object>(objDepRec[i], false);//依赖的资源不需要再检测路径,否则会出导致路径错误 } AssetBundle assetbundle = AssetBundle.LoadFromFile(strLatesVersionpath); if (assetbundle != null) { obj = assetbundle.LoadAsset <Object>(asset_name); _dictAssetBundles[strPath] = assetbundle; //引用计数初始化 if (!_dictAssetbundlesRefCount.ContainsKey(strPath)) { _dictAssetbundlesRefCount[strPath] = 0; } } // byte[] bytes = File.ReadAllBytes(strLatesVersionpath); // if (bytes != null && bytes.Length != 0) // { // AssetBundle assetbundle = AssetBundle.LoadFromMemory(bytes); // if (assetbundle != null) // { // obj = assetbundle.LoadAsset<Object>(asset_name); // _dictAssetBundles[strPath] = assetbundle; // //引用计数初始化 // if (!_dictAssetbundlesRefCount.ContainsKey(strPath)) // _dictAssetbundlesRefCount[strPath] = 0; // } // } } } else if (eType == EAssetPathType.eStreamingAssets) { JARUtilTools tools = GameSceneManager.uiCameraObj.GetComponent <JARUtilTools>(); if (tools != null) { string[] objDepRec = AssetManager.getInstance().getAssetBundleDependencies(strPath); for (int i = 0; i < objDepRec.Length; i++) { loadAsset <Object>(objDepRec[i], false);//依赖的资源不需要再检测路径,否则会出导致路径错误 } string path = IPath.getPlatformName() + "/" + strPath; string stream_asset_path = IPath.getPlatformName() + "/" + strPath; #if UNITY_EDITOR stream_asset_path = strLatesVersionpath; #endif AssetBundle assetbundle = AssetBundle.LoadFromFile(strLatesVersionpath); if (assetbundle != null) { obj = assetbundle.LoadAsset <Object>(asset_name); _dictAssetBundles[strPath] = assetbundle; //引用计数初始化 if (!_dictAssetbundlesRefCount.ContainsKey(strPath)) { _dictAssetbundlesRefCount[strPath] = 0; } } // byte[] bytes = tools.GetAssetBundleBytes(stream_asset_path); // if (bytes != null && bytes.Length != 0) // { // AssetBundle assetbundle = AssetBundle.LoadFromMemory(bytes); // if (assetbundle != null) // { // obj = assetbundle.LoadAsset<Object>(asset_name); // _dictAssetBundles[strPath] = assetbundle; // //引用计数初始化 // if (!_dictAssetbundlesRefCount.ContainsKey(strPath)) // _dictAssetbundlesRefCount[strPath] = 0; // } // } } } else// (eType == EAssetPathType.eResources || (eType == EAssetPathType.eNone)) { obj = Resources.Load(strLatesVersionpath); //addAssetBundle(strPath, obj); } } return((T)obj); }
public static async Task <VirtualFile> Analyze(Context context, VirtualFile parent, IExtractedFile extractedFile, IPath relPath, int depth = 0) { var hash = await extractedFile.HashAsync(); if (!context.UseExtendedHashes && FileExtractor.MightBeArchive(relPath.FileName.Extension)) { var result = await TryGetContentsFromServer(hash); if (result != null) { Utils.Log($"Downloaded VFS data for {relPath.FileName}"); VirtualFile Convert(IndexedVirtualFile file, IPath path, VirtualFile vparent) { var vself = new VirtualFile { Context = context, Name = path, Parent = vparent, Size = file.Size, LastModified = extractedFile.LastModifiedUtc.AsUnixTime(), LastAnalyzed = DateTime.Now.AsUnixTime(), Hash = file.Hash }; vself.FillFullPath(); vself.Children = file.Children.Select(f => Convert(f, f.Name, vself)).ToImmutableList(); return(vself); } return(Convert(result, relPath, parent)); } } var self = new VirtualFile { Context = context, Name = relPath, Parent = parent, Size = extractedFile.Size, LastModified = extractedFile.LastModifiedUtc.AsUnixTime(), LastAnalyzed = DateTime.Now.AsUnixTime(), Hash = hash }; self.FillFullPath(depth); if (context.UseExtendedHashes) { self.ExtendedHashes = ExtendedHashes.FromFile(extractedFile); } if (!await extractedFile.CanExtract()) { return(self); } try { await using var extracted = await extractedFile.ExtractAll(context.Queue); var list = await extracted .PMap(context.Queue, file => Analyze(context, self, file.Value, file.Key, depth + 1)); self.Children = list.ToImmutableList(); } catch (Exception ex) { Utils.Log($"Error while examining the contents of {relPath.FileName}"); throw; } return(self); }
/// <summary> /// Generates a outline of the path with alternating on and off segments based on the pattern. /// </summary> /// <param name="path">the path to outline</param> /// <param name="width">The final width outline</param> /// <param name="pattern">The pattern made of multiples of the width.</param> /// <param name="startOff">Weather the first item in the pattern is on or off.</param> /// <returns>A new path representing the outline.</returns> public static IPath GenerateOutline(this IPath path, float width, float[] pattern, bool startOff) => path.GenerateOutline(width, new ReadOnlySpan <float>(pattern), startOff);
/// <summary> /// Initializes a new instance of the <see cref="ShapeRegion"/> class. /// </summary> /// <param name="shape">The shape.</param> public ShapeRegion(IPath shape) { this.Shape = shape.AsClosedPath(); this.Bounds = shape.Bounds.Convert(); }
public static void ExecuteJsonToSqlite() { Excel2SQLiteTools.GenJsonToSQLite(IPath.Combine(Application.streamingAssetsPath, BDUtils.GetPlatformPath(Application.platform))); Debug.Log("表格导出完毕"); }
public void Init(IPath path) { _path = path; _path.PositionAdded += OnNewPositionCreated; }
public RepairSpoolFolderAssistant(IInteractionInvoker interactionInvoker, ITranslator translator, ISpoolerProvider spoolerProvider, IShellExecuteHelper shellExecuteHelper, IPath path, IFile file, IEnvironment environment, IAssemblyHelper assemblyHelper) { _interactionInvoker = interactionInvoker; _translator = translator; _shellExecuteHelper = shellExecuteHelper; _path = path; _file = file; _environment = environment; _assemblyHelper = assemblyHelper; _tempFolder = _path.GetFullPath(_path.Combine(spoolerProvider.SpoolFolder, "..")); }
/// <summary> /// Generates a solid outline of the path. /// </summary> /// <param name="path">the path to outline</param> /// <param name="width">The final width outline</param> /// <returns>A new path representing the outline.</returns> public static IPath GenerateOutline(this IPath path, float width) => GenerateOutline(path, width, JointStyle.Square, EndCapStyle.Butt);