private bool SolidContains(PointF location) { //Get boundary RectangleF bounds = TransformRectangle; //If inside inflate boundary if (bounds.Contains(location)) { //Check the outline offset to the path (0,0) location.X -= TransformRectangle.X; location.Y -= TransformRectangle.Y; //Can return in use error try { if (TransformPath.IsVisible(location)) { return(true); } } catch { } } return(false); }
private PointF GetIntercept(PointF location) { //Cache the location properties float x = X; float y = Y; PointF center = Center; //Create transform location moved to the path origin and check if inside path PointF transform = new PointF(location.X - x, location.Y - y); if (TransformPath.IsVisible(transform)) { return(center); } //Get the bounding rectangle intercept and move it to the origin //because all path measurements are from the origin location = Geometry.RectangleIntersection(location, center, TransformRectangle); location = new PointF(location.X - x, location.Y - y); //Get the center of the shape offset to the path origin center = new PointF(center.X - x, center.Y - y); location = Geometry.GetPathIntercept(location, center, TransformPath, Component.Instance.DefaultPen, mTransformInternalRectangle); location = Units.RoundPoint(location, 1); return(new PointF(location.X + x, location.Y + y)); }
private string CreateIconPath() { StringBuilder sb = new StringBuilder(); sb.Append("file:///"); sb.Append(TransformPath.Replace(@"\", "/")); sb.Append("/"); return(sb.ToString()); }
public void SaveToXml(string path) { var cutscene = new Cutscene { cameraFocusObjectPath = TransformPath.GetPath(cameraFocus.transform), dialogMessages = dialogMessages, }; XmlConverter.SerializeAndSave(path, cutscene); }
//Performs hit testing for an element from a location //if a valid diagram provided, hit testing is performed using current transform private bool ShapeContains(PointF location) { //Inflate rectangle to include selection handles RectangleF bound = TransformRectangle; //Inflate rectangle to include grab handles IRender render = RenderFromContainer(); float handle = 6 * render.ZoomFactor; bound.Inflate(handle, handle); //If inside inflate boundary if (bound.Contains(location)) { //Return true if clicked in selection rectangle but not path rectangle if (Selected && !TransformRectangle.Contains(location)) { return(true); } //Check the outline offset to the path (0,0) location.X -= Rectangle.X; location.Y -= Rectangle.Y; if (DrawBackground) { if (TransformPath.IsVisible(location)) { return(true); } } else { //Get bounding rect float width = BorderWidth + 2; if (TransformPath.IsOutlineVisible(location, new Pen(Color.Black, width))) { return(true); } } } return(false); }
//Takes the port and validates its location against the shape's path public bool ValidatePortLocation(Port port, PointF location) { //Check for switch changes if (!port.AllowRotate) { PortOrientation orientation = Geometry.GetOrientation(location, Center, Bounds); if (port.Orientation != orientation) { return(false); } } //Offset location to local co-ordinates and check outline location.X -= Bounds.X; location.Y -= Bounds.Y; return(TransformPath.IsOutlineVisible(location, new Pen(Color.Black, 5))); }
private static XsltArgumentList GetParameters(XmlNode rNode) { var parameterList = new XsltArgumentList(); foreach (XmlNode rParamNode in rNode.ChildNodes) { if (rParamNode.Name == "param") { string name = XmlUtils.GetManditoryAttributeValue(rParamNode, "name"); string value = XmlUtils.GetManditoryAttributeValue(rParamNode, "value"); if (value == "TransformDirectory") { value = TransformPath.Replace("\\", "/"); } parameterList.AddParam(name, "", value); } } return(parameterList); }
private static XmlUtils.XSLParameter[] GetParameters(int cParams, XmlNode rNode) { var parameterList = new XmlUtils.XSLParameter[cParams]; int i = 0; foreach (XmlNode rParamNode in rNode.ChildNodes) { if (rParamNode.Name == "param") { string sName = XmlUtils.GetManditoryAttributeValue(rParamNode, "name"); string sValue = XmlUtils.GetManditoryAttributeValue(rParamNode, "value"); if (sValue == "TransformDirectory") { sValue = TransformPath.Replace("\\", "/"); } parameterList[i] = new XmlUtils.XSLParameter(sName, sValue); i++; } } return(parameterList); }
public void ProjectOnToPath( TransformPath path, int nodeCount, float normStartLength, float normEndLength ) { if( nodeCount < 2 ) return; int nodeCountDifference = nodeCount - m_PathNodes.Count; if( nodeCountDifference > 0 ) { for( int i = 0; i < nodeCountDifference; i++ ) { AddNodeAtEnd( transform ); } } else { for( int i = 0; i < Mathf.Abs( nodeCountDifference ); i++ ) { m_PathNodes.RemoveAt(0); } } float normalizedRange = normEndLength - normStartLength; for( int i = 0; i < m_PathNodes.Count; i++ ) { float normLength = normStartLength + ( ( (float)i / ( m_PathNodes.Count - 1 ) ) * normalizedRange ); //float normLength = .5f; m_PathNodes[ i ].transform.position = path.GetPosAtNormLength( normLength ); } CalculateLength(); }