public override void Set(Conduit conduit) { m_Conduit = conduit; var bend = m_Conduit.bend; var travelColor = bend.GetOutputParameter(EBendParameterName.Travel).color; // Create Flags float lineWidth = Engine.conduitDiameterM * Mathf.Sin(Mathf.PI * 0.25f); m_travelLine1 = FlagRenderer.NewLine(m_Conduit.transform); m_travelLine1.SetWidth(lineWidth); m_travelLine1.SetColor(travelColor); m_travelLine2 = FlagRenderer.NewLine(m_Conduit.transform); m_travelLine2.SetWidth(lineWidth); m_travelLine2.SetColor(travelColor); // Create Obstacle m_obstacle = GameObject.CreatePrimitive(PrimitiveType.Cylinder); var renderer = m_obstacle.GetComponent <MeshRenderer>(); renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; renderer.receiveShadows = false; renderer.material = material; renderer.material.SetColor("_Color", new Color(0.2f, 0.2f, 0.2f, 1f)); GameObject.DestroyObject(m_obstacle.GetComponent <Collider>()); m_obstacle.transform.SetParent(transform); m_obstacle.transform.localPosition = new Vector3(-k_objstacleLength, 0f, 0f); m_obstacle.transform.localRotation = Quaternion.Euler(0f, 0f, 90f); }
public override void Set(Conduit conduit) { m_Conduit = conduit; // Create Rays rays[0] = FlagRenderer.NewRay(transform); rays[1] = FlagRenderer.NewRay(transform); rays[2] = FlagRenderer.NewRay(transform); }
// Update is called once per frame void Update() { rotateRayDir = Quaternion.AngleAxis(degPerSec * Time.deltaTime, crossProduct) * rotateRayDir; rotRay.origin = transform.position; rotRay.direction = rotateRayDir; SetCrossProduct(); FlagRenderer.DrawRay(crossProductRayObj, cpRay, cpRayColor); FlagRenderer.DrawRay(rotateRayObj, rotRay); }
// Use this for initialization void Start() { rotRayColor = Color.yellow; cpRay = new Ray(); rotRay = new Ray(); SetCrossProduct(); crossProductRayObj = FlagRenderer.NewRay(transform, cpRayColor); rotateRayObj = FlagRenderer.NewRay(transform, rotRayColor); rotateRayDir = transform.up; }
private void InitControls() { if (!this.useSourceConnector) { int increaseHeight = this.sourceDbProfile.Height; this.sourceDbProfile.Visible = false; this.btnCompare.Height = this.targetDbProfile.ClientHeight; this.targetDbProfile.Top -= increaseHeight; this.splitContainer1.Top -= increaseHeight; this.splitContainer1.Height += increaseHeight; } this.colType.ImageGetter = delegate(object x) { DbDifference difference = x as DbDifference; if (difference.DatabaseObjectType == DatabaseObjectType.None) { return("tree_Folder.png"); } else { return($"tree_{difference.DatabaseObjectType}.png"); } }; TreeRenderer treeColumnRenderer = this.tlvDifferences.TreeColumnRenderer; treeColumnRenderer.IsShowGlyphs = true; treeColumnRenderer.UseTriangles = true; TreeRenderer renderer = this.tlvDifferences.TreeColumnRenderer; renderer.LinePen = new Pen(Color.LightGray, 0.5f); renderer.LinePen.DashStyle = DashStyle.Dot; FlagRenderer differenceTypeRenderer = new FlagRenderer(); differenceTypeRenderer.ImageList = this.imageList2; differenceTypeRenderer.Add(DbDifferenceType.Added, "Add.png"); differenceTypeRenderer.Add(DbDifferenceType.Modified, "Edit.png"); differenceTypeRenderer.Add(DbDifferenceType.Deleted, "Remove.png"); this.colChangeType.Renderer = differenceTypeRenderer; this.colChangeType.ClusteringStrategy = new FlagClusteringStrategy(typeof(DbDifferenceType)); this.tlvDifferences.Refresh(); }
public override void Set(Conduit conduit) { m_Conduit = conduit; var bend = m_Conduit.bend; //---------------------- // Create Line Flags //---------------------- m_LineWidth = Engine.conduitDiameterM * Mathf.Sin(Mathf.PI * 0.25f); m_TakeUpLine = FlagRenderer.NewLine(transform); m_TakeUpLine.SetWidth(m_LineWidth); m_TakeUpLine.SetColor(bend.GetOutputParameter(EBendParameterName.StubTakeUp).color); }
public override void Set(Conduit conduit) { m_Conduit = conduit; //---------------------- // Create Line Flags //---------------------- var bend = m_Conduit.bend; m_LineWidth = Engine.conduitDiameterM * Mathf.Sin(Mathf.PI * 0.25f); m_RollLine = FlagRenderer.NewLine(transform); m_RollLine.SetWidth(m_LineWidth * 0.7f); m_RollLine.SetColor(bend.GetInputParameter(EBendParameterName.Roll).color); m_RiseLine = FlagRenderer.NewLine(transform); m_RiseLine.SetWidth(m_LineWidth * 0.75f); m_RiseLine.SetColor(bend.GetInputParameter(EBendParameterName.Rise).color); EnableLines(false); // Rotate Conduit Decorate(); }
public override void Set(Conduit conduit) { Initialize(); m_Conduit = conduit; //---------------------- // Create Line Flags //---------------------- float lineWidth = Engine.conduitDiameterM * Mathf.Sin(Mathf.PI * 0.25f); m_SpreadLine = FlagRenderer.NewLine(m_Conduit.transform); m_SpreadLine.SetWidth(lineWidth); m_ShiftLine = FlagRenderer.NewLine(transform); m_ShiftLine.SetWidth(lineWidth); m_FirstMarkLine = FlagRenderer.NewLine(m_Conduit.transform); m_FirstMarkLine.SetWidth(lineWidth); m_TravelLine = FlagRenderer.NewLine(m_Conduit.transform); m_TravelLine.SetWidth(Engine.conduitDiameterM * 0.5f); // Set Marker Colors var bend = m_Conduit.bend; m_SpreadLine.SetColor(bend.GetOutputParameter(EBendParameterName.KickSpread).color); m_ShiftLine.SetColor(bend.GetOutputParameter(EBendParameterName.Shift).color); m_FirstMarkLine.SetColor(bend.GetOutputParameter(EBendParameterName.KickFirstMark).color); m_TravelLine.SetColor(bend.GetOutputParameter(EBendParameterName.KickTravel).color); if (m_Conduit.centerlineBendIndices.Count == 4) { UnityEngine.Debug.Log("ConduitParallelKickDecorator: Set() Decorating..."); lastAngleDeg = -1; Decorate(); } }
private void SetupColumns() { // Get the size of the file system entity. // Folders and errors are represented as negative numbers this.olvColumnSize.AspectGetter = delegate(object x) { if (x is DirectoryInfo) { return((long)-1); } try { return(((FileInfo)x).Length); } catch (System.IO.FileNotFoundException) { // Mono 1.2.6 throws this for hidden files return((long)-2); } }; // Show the size of files as GB, MB and KBs. By returning the actual // size in the AspectGetter, and doing the conversion in the // AspectToStringConverter, sorting on this column will work off the // actual sizes, rather than the formatted string. this.olvColumnSize.AspectToStringConverter = delegate(object x) { long sizeInBytes = (long)x; if (sizeInBytes < 0) // folder or error { return(""); } return(Coordinator.FormatFileSize(sizeInBytes)); }; this.olvColumnSize.MakeGroupies(new long[] { 0, 1024 * 1024, 512 * 1024 * 1024 }, new string[] { "Folders", "Small", "Big", "Disk space chewer" }); // Group by month-year, rather than date // This code is duplicated for FileCreated and FileModified, so we really should // create named methods rather than using anonymous delegates. this.olvColumnCreated.GroupKeyGetter = delegate(object x) { DateTime dt = ((FileSystemInfo)x).CreationTime; return(new DateTime(dt.Year, dt.Month, 1)); }; this.olvColumnCreated.GroupKeyToTitleConverter = delegate(object x) { return(((DateTime)x).ToString("MMMM yyyy")); }; // Group by month-year, rather than date this.olvColumnModified.GroupKeyGetter = delegate(object x) { DateTime dt = ((FileSystemInfo)x).LastWriteTime; return(new DateTime(dt.Year, dt.Month, 1)); }; this.olvColumnModified.GroupKeyToTitleConverter = delegate(object x) { return(((DateTime)x).ToString("MMMM yyyy")); }; // Show the system description for this object this.olvColumnFileType.AspectGetter = delegate(object x) { return(ShellUtilities.GetFileType(((FileSystemInfo)x).FullName)); }; // Show the file attributes for this object // A FlagRenderer masks off various values and draws zero or more images based // on the presence of individual bits. this.olvColumnAttributes.AspectGetter = delegate(object x) { return(((FileSystemInfo)x).Attributes); }; FlagRenderer attributesRenderer = new FlagRenderer(); attributesRenderer.ImageList = imageList1; attributesRenderer.Add(FileAttributes.Archive, "archive"); attributesRenderer.Add(FileAttributes.ReadOnly, "readonly"); attributesRenderer.Add(FileAttributes.System, "system"); attributesRenderer.Add(FileAttributes.Hidden, "hidden"); attributesRenderer.Add(FileAttributes.Temporary, "temporary"); this.olvColumnAttributes.Renderer = attributesRenderer; // Tell the filtering subsystem that the attributes column is a collection of flags this.olvColumnAttributes.ClusteringStrategy = new FlagClusteringStrategy(typeof(FileAttributes)); }
public override void Decorate() { // Find Centerline Bend Marks var centerline = m_Conduit.centerline; var indices = m_Conduit.centerlineBendIndices; var conduitRadius = Engine.conduitDiameterM * 0.5f; var bi = 0; for (int i = 0; i < indices.Count; ++i) { if (indices[i].type == BendMarkType.Start || indices[i].type == BendMarkType.End) { bendIndices[bi++] = indices[i].index; } } if (bi < 6) { // Rays Off ToggleRays(false); return; } ToggleRays(true); // Arrow locations are dependent on Bend Method var bend = m_Conduit.bend; var centerAngle = (float)bend.GetInputParameter(EBendParameterName.CenterAngleDegrees).value; //var bendMethod = (GlobalEnum.ESaddle3BendMethod) bend.GetInputParameter(EBendParameterName.Saddle3Method).value; //if(bendMethod == GlobalEnum.ESaddle3BendMethod.Notch) //{ // Determine Points int centerOfCenterBend = (bendIndices[3] - bendIndices[2]) / 2 + bendIndices[2]; Vector3 bend1Dir = centerline[bendIndices[1]].radialDir; Vector3 bend2Dir = transform.up; Vector3 bend3Dir = centerline[bendIndices[4]].radialDir; bendPoints[0] = m_Conduit.transform.TransformPoint(centerline[bendIndices[1]].point) + bend1Dir * conduitRadius; bendPoints[1] = m_Conduit.transform.TransformPoint(centerline[centerOfCenterBend].point) + bend2Dir * conduitRadius; bendPoints[2] = m_Conduit.transform.TransformPoint(centerline[bendIndices[4]].point) + bend3Dir * conduitRadius; // Draw Arrows FlagRenderer.DrawRay(rays[0], -bend1Dir, bendPoints[0]); FlagRenderer.DrawRay(rays[1], -bend2Dir, bendPoints[1]); FlagRenderer.DrawRay(rays[2], -bend3Dir, bendPoints[2]); //} //else if(bendMethod == GlobalEnum.ESaddle3BendMethod.Arrow) //{ // // Determine Points // Vector3 bend1Dir = centerline[ bendIndices[ 1 ] ].radialDir; // Vector3 bend2Dir = -centerline[ bendIndices[ 2 ] ].radialDir; // Vector3 bend3Dir = centerline[ bendIndices[ 4 ] ].radialDir; // bendPoints[ 0 ] = m_Conduit.transform.TransformPoint( centerline[ bendIndices[ 1 ] ].point ) + bend1Dir * conduitRadius; // bendPoints[ 1 ] = m_Conduit.transform.TransformPoint( centerline[ bendIndices[ 2 ] ].point ) + bend2Dir * conduitRadius; // bendPoints[ 2 ] = m_Conduit.transform.TransformPoint( centerline[ bendIndices[ 4 ] ].point ) + bend3Dir * conduitRadius; // // Draw Arrows // FlagRenderer.DrawRay( rays[ 0 ], -bend1Dir, bendPoints[ 0 ] ); // FlagRenderer.DrawRay( rays[ 1 ], -bend2Dir, bendPoints[ 1 ] ); // FlagRenderer.DrawRay( rays[ 2 ], -bend3Dir, bendPoints[ 2 ] ); //} }
void InitializeTreeListExample() { this.treeListView.HierarchicalCheckboxes = true; this.treeListView.HideSelection = false; this.treeListView.CanExpandGetter = delegate(object x) { return(((MyFileSystemInfo)x).IsDirectory); }; this.treeListView.ChildrenGetter = delegate(object x) { MyFileSystemInfo myFileSystemInfo = (MyFileSystemInfo)x; try { return(myFileSystemInfo.GetFileSystemInfos()); } catch (UnauthorizedAccessException ex) { MessageBox.Show(this, ex.Message, "ObjectListViewDemo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(new ArrayList()); } }; // You can change the way the connection lines are drawn by changing the pen TreeListView.TreeRenderer renderer = this.treeListView.TreeColumnRenderer; renderer.LinePen = new Pen(Color.Firebrick, 0.5f); renderer.LinePen.DashStyle = DashStyle.Dot; //------------------------------------------------------------------- // Eveything after this is the same as the Explorer example tab -- // nothing specific to the TreeListView. It doesn't have the grouping // delegates, since TreeListViews can't show groups. // Draw the system icon next to the name SysImageListHelper helper = new SysImageListHelper(this.treeListView); this.colName.ImageGetter = delegate(object x) { return(helper.GetImageIndex(((MyFileSystemInfo)x).FullName)); }; // Show the size of files as GB, MB and KBs. Also, group them by // some meaningless divisions this.colSize.AspectGetter = delegate(object x) { MyFileSystemInfo myFileSystemInfo = (MyFileSystemInfo)x; if (myFileSystemInfo.IsDirectory) { return((long)-1); } try { return(myFileSystemInfo.Length); } catch (System.IO.FileNotFoundException) { // Mono 1.2.6 throws this for hidden files return((long)-2); } }; this.colSize.AspectToStringConverter = delegate(object x) { if ((long)x == -1) // folder { return(""); } return(FormatFileSize((long)x)); }; // Show the system description for this object this.colType.AspectGetter = delegate(object x) { return(ShellUtilities.GetFileType(((MyFileSystemInfo)x).FullName)); }; // Show the file attributes for this object this.colAttrs.AspectGetter = delegate(object x) { return(((MyFileSystemInfo)x).Attributes); }; FlagRenderer attributesRenderer = new FlagRenderer(); attributesRenderer.Add(FileAttributes.Archive, "archive"); attributesRenderer.Add(FileAttributes.ReadOnly, "readonly"); attributesRenderer.Add(FileAttributes.System, "system"); attributesRenderer.Add(FileAttributes.Hidden, "hidden"); attributesRenderer.Add(FileAttributes.Temporary, "temporary"); this.colAttrs.Renderer = attributesRenderer; this.colAttrs.ClusteringStrategy = new FlagClusteringStrategy(typeof(FileAttributes)); // List all drives as the roots of the tree ArrayList roots = new ArrayList(); foreach (DriveInfo di in DriveInfo.GetDrives()) { if (di.IsReady) { roots.Add(new MyFileSystemInfo(new DirectoryInfo(di.Name))); break; } } this.treeListView.Roots = roots; }
private void SetupColumns() { // The column setup here is identical to the File Explorer example tab -- // nothing specific to the TreeListView. // The only difference is that we don't setup anything to do with grouping, // since TreeListViews can't show groups. SysImageListHelper helper = new SysImageListHelper(this.treeListView); this.olvColumnName.ImageGetter = delegate(object x) { return(helper.GetImageIndex(((MyFileSystemInfo)x).FullName)); }; // Get the size of the file system entity. // Folders and errors are represented as negative numbers this.olvColumnSize.AspectGetter = delegate(object x) { MyFileSystemInfo myFileSystemInfo = (MyFileSystemInfo)x; if (myFileSystemInfo.IsDirectory) { return((long)-1); } try { return(myFileSystemInfo.Length); } catch (System.IO.FileNotFoundException) { // Mono 1.2.6 throws this for hidden files return((long)-2); } }; // Show the size of files as GB, MB and KBs. By returning the actual // size in the AspectGetter, and doing the conversion in the // AspectToStringConverter, sorting on this column will work off the // actual sizes, rather than the formatted string. this.olvColumnSize.AspectToStringConverter = delegate(object x) { long sizeInBytes = (long)x; if (sizeInBytes < 0) // folder or error { return(""); } return(Coordinator.FormatFileSize(sizeInBytes)); }; // Show the system description for this object this.olvColumnFileType.AspectGetter = delegate(object x) { return(ShellUtilities.GetFileType(((MyFileSystemInfo)x).FullName)); }; // Show the file attributes for this object // A FlagRenderer masks off various values and draws zero or images based // on the presence of individual bits. this.olvColumnAttributes.AspectGetter = delegate(object x) { return(((MyFileSystemInfo)x).Attributes); }; FlagRenderer attributesRenderer = new FlagRenderer(); attributesRenderer.ImageList = imageListSmall; attributesRenderer.Add(FileAttributes.Archive, "archive"); attributesRenderer.Add(FileAttributes.ReadOnly, "readonly"); attributesRenderer.Add(FileAttributes.System, "system"); attributesRenderer.Add(FileAttributes.Hidden, "hidden"); attributesRenderer.Add(FileAttributes.Temporary, "temporary"); this.olvColumnAttributes.Renderer = attributesRenderer; // Tell the filtering subsystem that the attributes column is a collection of flags this.olvColumnAttributes.ClusteringStrategy = new FlagClusteringStrategy(typeof(FileAttributes)); }
void InitializeTreeListExample() { //TreeListViewItem it = new TreeListViewItem("Deepak"); //it.SubItems.Add("Rupam"); //treeListView2.Items.Add(it); this.treeListView.CanExpandGetter = delegate(object x) { return(x is DirectoryInfo); }; this.treeListView.ChildrenGetter = delegate(object x) { DirectoryInfo dir = (DirectoryInfo)x; //dir.GetFileSystemInfos(). return(new ArrayList(dir.GetFileSystemInfos())); }; this.treeListView.CheckBoxes = true; // You can change the way the connection lines are drawn by changing the pen //((TreeListView.TreeRenderer)this.treeListView.TreeColumnRenderer).LinePen = Pens.Firebrick; // ((TreeListView.TreeRenderer)this.treeListView.TreeColumnRenderer).LinePen.Color = Color.Black; //((TreeListView.TreeRenderer)this.treeListView.TreeColumnRenderer).LinePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; //------------------------------------------------------------------- // Eveything after this is the same as the Explorer example tab -- // nothing specific to the TreeListView. It doesn't have the grouping // delegates, since TreeListViews can't show groups. /* // Draw the system icon next to the name #if !MONO * SysImageListHelper helper = new SysImageListHelper(this.treeListView); * this.treeColumnName.ImageGetter = delegate(object x) * { * return helper.GetImageIndex(((FileSystemInfo)x).FullName); * }; #endif */ // Show the size of files as GB, MB and KBs. Also, group them by // some meaningless divisions this.treeColumnSize.AspectGetter = delegate(object x) { if (x is DirectoryInfo) { return((long)-1); } try { return(((FileInfo)x).Length); } catch (System.IO.FileNotFoundException) { // Mono 1.2.6 throws this for hidden files return((long)-2); } }; this.treeColumnSize.AspectToStringConverter = delegate(object x) { if ((long)x == -1) // folder { return(""); } else { //return this.FormatFileSize((long)x); return((string)"Deepak"); } }; // Show the system description for this object this.treeColumnFileType.AspectGetter = delegate(object x) { //return ShellUtilities.GetFileType(((FileSystemInfo)x).FullName); return("Jagruti"); }; // Show the file attributes for this object this.treeColumnAttributes.AspectGetter = delegate(object x) { return(((FileSystemInfo)x).Attributes); }; FlagRenderer <FileAttributes> attributesRenderer = new FlagRenderer <FileAttributes>(); attributesRenderer.Add(FileAttributes.Archive, "archive"); attributesRenderer.Add(FileAttributes.ReadOnly, "readonly"); attributesRenderer.Add(FileAttributes.System, "system"); attributesRenderer.Add(FileAttributes.Hidden, "hidden"); attributesRenderer.Add(FileAttributes.Temporary, "temporary"); this.treeColumnAttributes.Renderer = attributesRenderer; // List all drives as the roots of the tree ArrayList roots = new ArrayList(); foreach (DriveInfo di in DriveInfo.GetDrives()) { if (di.IsReady) { roots.Add(new DirectoryInfo(di.Name)); } } this.treeListView.Roots = roots; this.treeListView.CellEditActivation = ObjectListView.CellEditActivateMode.F2Only; }