// Use this for initialization void Start() { //confirm = GameObject.Find("confirmMethod").GetComponent<Button>(); Button btn = confirm.GetComponent <Button>(); method1 = GameObject.Find("method1").GetComponent <Button>(); method2 = GameObject.Find("method2").GetComponent <Button>(); method3 = GameObject.Find("method3").GetComponent <Button>(); method4 = GameObject.Find("method4").GetComponent <Button>(); method5 = GameObject.Find("method5").GetComponent <Button>(); methodCommand = GetComponent <MethodCommand>(); btnInstance = GetComponent <ButtonClick>(); foreach (Button b in savedMethods) { Button methodButton = b; methodButton.interactable = false; } methodPanel = methodCommand.methodPanel; btn.onClick.AddListener(TaskOnClick); method1.onClick.AddListener(MethodClick); method2.onClick.AddListener(MethodClick); method3.onClick.AddListener(MethodClick); method4.onClick.AddListener(MethodClick); method5.onClick.AddListener(MethodClick); }
internal static CircleModel Polyline2DModel(Polyline2d line, AttributeModel atModel) { CircleModel dbModel = new CircleModel(); double length = line.Length; dbModel.pointList = MethodCommand.GetArcPoints(line, length); dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue); foreach (AttributeItemModel item in atModel.attributeItems) { string attValue = ""; switch (item.AtItemType) { case AttributeItemType.Area: attValue = line.Area.ToString(); break; case AttributeItemType.TxtHeight: break; case AttributeItemType.Color: attValue = dbModel.Color; break; case AttributeItemType.Content: break; case AttributeItemType.LayerName: attValue = line.Layer; break; case AttributeItemType.LineScale: attValue = line.LinetypeScale.ToString(); break; case AttributeItemType.LineType: attValue = GetLayerLineTypeByID(line); break; case AttributeItemType.Overallwidth: attValue = line.ConstantWidth.ToString(); break; case AttributeItemType.TotalArea: break; } if (!string.IsNullOrEmpty(attValue)) { item.AtValue = attValue; dbModel.attItemList.Add(item); } } return(dbModel); }
public AgreementCreateVM(int custID) { Agreement = new Agreement(); Agreement.CustomerID = custID; CreateAgreement = new MethodCommand(AgreementCreate); GetProductGroups(); }
public AgreementEditVM(object selectedAgreement) { EditAgreement = new MethodCommand(AgreementEdit); CastToType(selectedAgreement); GetProductGroups(); SetProductGroup(); }
public ProductChangePriceVM() { UpdatedPrice = new MethodCommand(ChangePrice); GetProductGroups(); NotifyPropertyChanged(""); }
public PipeItemModel GetPipeItemInfo(Polyline line, List <MText> txtList) { PipeItemModel item = new PipeItemModel(); try { item.PipeLength = line.Length.ToString(); item.Style.LineWidth = line.ConstantWidth.ToString(); item.ColorIndex = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue); Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; using (Transaction tran = db.TransactionManager.StartTransaction()) { int vtnum = line.NumberOfVertices; MText mText = MethodCommand.FindMTextIsInPolyineForPipe(line, txtList); if (mText != null) { item.TxtLocation = new System.Drawing.PointF((float)mText.Location.X, (float)mText.Location.Y); item.PipeType = mText.Text; //Replace(" ", "").Replace(" ", ""); item.PipeLayer = mText.Layer; } } item.pipeList = PolylineMethod.GetPolyLineInfoPt(line); } catch { } return(item); }
/// <summary> /// 获取图层下的快参照 /// </summary> /// <param name="type"></param> /// <returns></returns> public static List <BlockReference> GetBlockReferenceByLayerType(string layerName) { List <BlockReference> references = new List <BlockReference>(); Database db = Application.DocumentManager.MdiActiveDocument.Database; BlockReference _br = null; Transaction trans = null; var list = MethodCommand.GetObjectIdsAtLayer(layerName); using (trans = db.TransactionManager.StartTransaction()) { if (list != null && list.Count > 0) { foreach (ObjectId id in list) { _br = trans.GetObject(id, OpenMode.ForRead) as BlockReference; if (_br != null) { references.Add(_br); } } } return(references); } }
// Use this for initialization void Start() { Button btn = leftButton.GetComponent <Button>(); Button btn1 = rightButton.GetComponent <Button>(); Button btn2 = upButton.GetComponent <Button>(); Button btn3 = downButton.GetComponent <Button>(); Button btn4 = whileButton.GetComponent <Button>(); Button btn5 = methodButton.GetComponent <Button>(); // methodContainer = GameObject.Find("methodContainer"); commandList = new List <string>(); whileList = new List <string>(); methodList = new List <string>(); jaggedWhileList = new List <List <string> >(); //whileActive = false; whileInstance = GetComponent <WhileCommand>(); methodInstance = GetComponent <MethodCommand>(); btn.onClick.AddListener(TaskOnClick); btn1.onClick.AddListener(TaskOnClick); btn2.onClick.AddListener(TaskOnClick); btn3.onClick.AddListener(TaskOnClick); btn4.onClick.AddListener(TaskOnClick); btn5.onClick.AddListener(TaskOnClick); }
public RoadInfoItemModel GetRoadItemInfo(MText text) { RoadInfoItemModel item = new RoadInfoItemModel(); item.RoadLength = ""; item.RoadWidth = ""; item.RoadType = ""; item.ColorIndex = ""; using (Transaction tran = CadHelper.Instance.Database.TransactionManager.StartTransaction()) { item.RoadName = text.Text.Replace(" ", "").Replace(" ", "").Replace("\r", "").Replace("\n", ""); item.RoadNameLocaiton = new List <System.Drawing.PointF>(); double textLen = text.TextHeight * item.RoadName.Length + text.LineSpaceDistance * (item.RoadName.Length - 1); double partLength = textLen / item.RoadName.Length; for (int j = 1; j < item.RoadName.Length + 1; j++) { item.RoadNameLocaiton.Add(MethodCommand.GetEndPointByTrigonometricHu(text.Rotation, MethodCommand.Point3d2Pointf(text.Location), partLength * j)); } item.RoadNameLayer = text.Layer; item.RoadNameType = "text"; } return(item); }
protected List <string> GetRealLayer(string lay) { //Document doc = Application.DocumentManager.MdiActiveDocument; //PromptSelectionResult ProSset = null; List <string> resultList = new List <string>(); List <string> layerList = MethodCommand.GetAllLayer(); string layerName = ""; if (lay.Contains("*")) { string temp = ""; temp = lay.Split('*')[1]; foreach (string laySpc in layerList) { if (laySpc.EndsWith(temp)) { resultList.Add(laySpc); } } } else { resultList.Add(lay); } return(resultList); }
public MainViewModel(IBackEndService service, TraceListenerViewModel traceMessages) { _backEndService = service; Initialize = new MethodCommand(_ => InitializeSessionAsync()); Sessions = new ObservableCollection <SessionViewModel>(); TraceMessages = traceMessages; }
public ProductVM() { ListProducts = ProductMethods.ListProducts(); SelectedMainGroup = "00"; Product = new Product(); CreateProduct = new MethodCommand(CreateProd); GetProductGroups(); GetSubGroups(); }
public ProductListVM() { ProductList = new List <Product>(); OpenProductEditWindow = new MethodCommand(EditProductWindow); ChangePriceWindow = new MethodCommand(ChangeProductPriceWindow); ProductDelete = new MethodCommand(DeleteProduct); ProductList = ProductMethods.ListProducts(); GetProducts(); }
public ProductEditVM(object selectedProduct) { EditProduct = new MethodCommand(ProductEdit); CastToType(selectedProduct); ListProducts = ProductMethods.ListProducts(); GetProductGroups(); SelectedMainGroup = ProductToEdit.ProductGroup.Substring(0, 2); SelectedSubGroup = ProductToEdit.ProductGroup.Substring(3, 3); }
public LoggingEntryProperties(LoggingEntry entry) { InitializeComponent(); CloseCommand = new MethodCommand((command, o) => this.Close()); Entry = entry; this.DataContext = this; }
public MainWindowVM() { SwapPageWelcomePages = new MethodCommand(PageSwapWelcomePages); SwapPageCustomerPages = new MethodCommand(PageSwapCustomerPages); SwapPageAgreementPages = new MethodCommand(PageSwapAgreementPages); SwapPageProductPages = new MethodCommand(PageSwapProductPages); SwapPageStatisticPages = new MethodCommand(PageSwapStatisticPages); CloseProgram = new MethodCommand(Close); Frame = new WelcomePage(); }
private static Command NewMethodCommand(Type classType, string methodName) { try { return(MethodCommand.New(classType.GetMethod(methodName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))); } catch (Exception e) { throw new NssIntegrationException($"初始化'{classType.Name}'中的函数'{methodName}'时失败", e); } }
public static DbTextModel DbText2Model(DBText dbText, AttributeModel atModel) { DbTextModel dbModel = new DbTextModel(); dbModel.attItemList = new List <AttributeItemModel>(); dbModel.Height = dbText.Height; //dbModel.Position = new System.Drawing.PointF((float)dbText.Position.X, (float)dbText.Position.Y); dbModel.Position = Point3d2Pointf(dbText.Position); dbModel.Rotation = dbText.Rotation; dbModel.ThickNess = dbText.Thickness; dbModel.Text = dbText.TextString.Replace(" ", "").Replace("\n", "").Replace("\r", ""); if (dbText.TextString.Replace(" ", "").Replace("\n", "").Replace("\r", "") == "纬三路") { } dbModel.Color = dbText.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(dbText.LayerId) : System.Drawing.ColorTranslator.ToHtml(dbText.Color.ColorValue); foreach (AttributeItemModel item in atModel.attributeItems) { string attValue = ""; switch (item.AtItemType) { case AttributeItemType.TxtHeight: attValue = dbText.Height.ToString(); break; case AttributeItemType.Color: attValue = dbModel.Color; break; case AttributeItemType.Content: attValue = dbText.TextString.Replace(" ", "").Replace(" ", "").Replace("\n", "").Replace("\r", ""); break; case AttributeItemType.LayerName: attValue = dbText.Layer; break; case AttributeItemType.LineScale: attValue = dbText.LinetypeScale.ToString(); break; case AttributeItemType.LineType: attValue = GetLayerLineTypeByID(dbText); break; } if (!string.IsNullOrEmpty(attValue)) { item.AtValue = attValue; dbModel.attItemList.Add(item); } } return(dbModel); }
public static DbTextModel DbText2Model(MText dbText) { DbTextModel dbModel = new DbTextModel(); dbModel.Height = dbText.ActualHeight; //dbModel.Position = new System.Drawing.PointF((float)dbText.Position.X, (float)dbText.Position.Y); dbModel.Position = Point3d2Pointf(dbText.Location); dbModel.Rotation = dbText.Rotation; // dbModel.ThickNess = dbText.TextHeight; dbModel.Text = dbText.Text; dbModel.Color = dbText.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(dbText.LayerId) : System.Drawing.ColorTranslator.ToHtml(dbText.Color.ColorValue); return(dbModel); }
internal static CircleModel Polyline2DModel(Polyline2d line) { CircleModel dbModel = new CircleModel(); double length = line.Length; dbModel.pointList = MethodCommand.GetArcPoints(line, length); dbModel.isDashed = GetLayerLineTypeByIDEx(line); dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue); return(dbModel); }
//public List<List<string>> jaggedCommandList = new List<List<string>>(); // Use this for initialization void Start() { //confirm = GameObject.Find("confirm").GetComponent<Button>(); //whilePanel = GameObject.Find("WhileField"); whileCommand = GetComponent <WhileCommand>(); btnInstance = GetComponent <ButtonClick>(); methodCommand = GetComponent <MethodCommand>(); whilePanel = whileCommand.whilePanel; confirm = whileCommand.confirm; confirm.onClick.AddListener(TaskOnClick); }
public static LineModel Line2Model(Line line) { LineModel dbModel = new LineModel(); dbModel.StartPoint = Point3d2Pointf(line.StartPoint); dbModel.EndPoint = Point3d2Pointf(line.EndPoint); dbModel.Angle = line.Angle; dbModel.Length = line.Length; dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue); dbModel.isDashed = GetLayerLineTypeByIDEx(line); return(dbModel); }
public void GetExportLayers(T model) { if (lengedList.Count > 0) { model.LayerList = new List <string>(); List <MText> txtList = GetAllLengedText(); foreach (MText dBText in txtList) { if (MethodCommand.FindDBTextIsInPolyine(dBText, model.LegendList)) { model.LayerList.Add(dBText.Text); } } } }
public static CircleModel Circle2Model(Circle line) { CircleModel dbModel = new CircleModel(); dbModel.Center = Point3d2Pointf(line.Center); dbModel.Radius = line.Radius; dbModel.GeoType = "Circle"; MyPoint spt = new MyPoint(line.StartPoint.X, line.StartPoint.Y); MyPoint ept = new MyPoint(line.EndPoint.X, line.EndPoint.Y); MyPoint center = new MyPoint(dbModel.Center.X, dbModel.Center.Y); dbModel.pointList = MethodCommand.GetArcPoints(line, line.Circumference); dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue); dbModel.isDashed = GetLayerLineTypeByIDEx(line); return(dbModel); }
/// <summary> /// 判断给定点 pt 是否在折线上: 1:在折线上;0:不在折线上 /// </summary> /// <param name="pt">待判断的点</param> /// <param name="polyline">线坐标列表</param> /// <param name="allowError">容差值(该值应包括线的宽度,如为零则表示精确匹配)</param> /// <returns>1:在折线上;0:不在折线上</returns> public static int PtInPolyLine(Point2d pt, Point2d l1, Point2d l2, double allowError) { //如果选择的点与当前点重合 if (Math.Abs(l2.X - pt.X) <= allowError && Math.Abs(l2.Y - pt.Y) <= allowError) { return(1); } if (Math.Min(l1.X, l2.X) <= pt.X && Math.Min(l1.Y, l2.Y) <= pt.Y && Math.Max(l1.X, l2.X) >= pt.X && Math.Max(l1.Y, l2.Y) >= pt.Y) { //精确匹配判断的话 if (Math.Abs(allowError - 0.0) <= 0.0001) { Point2d tp1 = new Point2d(l2.X - pt.X, l2.Y - pt.Y); //矢量减法 Point2d tp2 = new Point2d(pt.X - l1.X, pt.Y - l1.Y); //矢量减法 if (Math.Abs(Math.Abs(tp1.X * tp2.Y - tp2.X * tp1.Y) - 0.0) <= 0.00000001) //矢量叉乘,平行四边形的面积 { return(1); } } else { if (Math.Abs(l2.X - l1.X) <= allowError && Math.Abs(l2.X - pt.X) <= allowError) { return(1); } if (Math.Abs(l2.Y - l1.Y) <= allowError && Math.Abs(l2.Y - pt.Y) <= allowError) { return(1); } if (MethodCommand.DistancePointToSegment(pt, l1, l2) <= allowError) { return(1); } //如果点到线段的距离在容差范围内,则选取成功 if (MethodCommand.DistancePointToSegment(pt, l1, l2) <= allowError) { return(1); } } } return(0); }
public static EllipseModel Ellipse2Model(Ellipse line) { EllipseModel dbModel = new EllipseModel(); dbModel.Center = Point3d2Pointf(line.Center); dbModel.MajorAxis = line.MajorRadius; dbModel.MinorAxis = line.MinorRadius; dbModel.GeoType = "Ellipse"; MyPoint spt = new MyPoint(line.StartPoint.X, line.StartPoint.Y); MyPoint ept = new MyPoint(line.EndPoint.X, line.EndPoint.Y); MyPoint center = new MyPoint(dbModel.Center.X, dbModel.Center.Y); double length = line.RadiusRatio * (line.MinorRadius + line.MajorRadius); dbModel.pointList = MethodCommand.GetArcPoints(line, length); dbModel.isDashed = GetLayerLineTypeByIDEx(line); dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue); return(dbModel); }
// Use this for initialization void Start() { /*Button btn = leftButton.GetComponent<Button>(); * Button btn1 = rightButton.GetComponent<Button>(); * Button btn2 = upButton.GetComponent<Button>(); * Button btn3 = downButton.GetComponent<Button>();*/ // Button btn4 = whileButton.GetComponent<Button>(); //Button btn5 = methodButton.GetComponent<Button>(); //Mairim //Button submitBtn = submit.GetComponent<Button>(); //submitBtn.onClick.AddListener (SubmitCommands); //Record original position of the player //originalPos = player.transform.position; //Button clearBtn = clear.GetComponent<Button>(); //clearBtn.onClick.AddListener (ClearCommands); // methodContainer = GameObject.Find("methodContainer"); commandList = new List <string>(); whileList = new List <string>(); methodList = new List <string>(); jaggedWhileList = new List <List <string> >(); //whileActive = false; whileInstance = GetComponent <WhileCommand>(); methodInstance = GetComponent <MethodCommand>(); /* * btn.onClick.AddListener(TaskOnClick); * btn1.onClick.AddListener(TaskOnClick); * btn2.onClick.AddListener(TaskOnClick); * btn3.onClick.AddListener(TaskOnClick);*/ // btn4.onClick.AddListener(TaskOnClick); // btn5.onClick.AddListener(TaskOnClick); }
internal static ArcModel Arc2Model(Arc line) { ArcModel dbModel = new ArcModel(); dbModel.Center = Point3d2Pointf(line.Center); dbModel.EndAngel = line.EndAngle; dbModel.EndPoint = MethodCommand.Point3d2Pointf(line.EndPoint); dbModel.Startangel = line.StartAngle; dbModel.StartPoint = MethodCommand.Point3d2Pointf(line.StartPoint); dbModel.GeoType = "Arc"; //dbModel.MajorAxis= line.MajorRadius; //dbModel.MinorAxis = line.MinorRadius; MyPoint spt = new MyPoint(line.StartPoint.X, line.StartPoint.Y); MyPoint ept = new MyPoint(line.EndPoint.X, line.EndPoint.Y); MyPoint center = new MyPoint(dbModel.Center.X, dbModel.Center.Y); double length = line.Length; dbModel.pointList = MethodCommand.GetArcPoints(line, length); dbModel.isDashed = GetLayerLineTypeByIDEx(line); dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue); return(dbModel); }
public static DbTextModel DbText2Model(DBText dbText) { DbTextModel dbModel = new DbTextModel(); dbModel.Height = dbText.Height; //dbModel.Position = new System.Drawing.PointF((float)dbText.Position.X, (float)dbText.Position.Y); dbModel.Position = Point3d2Pointf(dbText.Position); dbModel.Rotation = dbText.Rotation; dbModel.ThickNess = dbText.Thickness; dbModel.Text = dbText.TextString; dbModel.Color = dbText.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(dbText.LayerId) : System.Drawing.ColorTranslator.ToHtml(dbText.Color.ColorValue); ////获取文本 //string text = dbModel.Text; ////得到Bitmap(传入Rectangle.Empty自动计算宽高) //Bitmap bmp = TextToBitmap(text, new Font("Arial", 16), Rectangle.Empty, Color.FromName(dbModel.Color), Color.FromName("White")); ////保存到桌面save.jpg //string directory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory); //bmp.Save(directory + "\\save.png", System.Drawing.Imaging.ImageFormat.Png); return(dbModel); }
private static void SerializeHeader(byte[] packet, int id, MethodCommand command) { SerializeHeader(packet, packet.Length, id, 0, (byte)CommandSet.Method, (byte)command); }
public CustomerCreateVM() { Customer = new Customer(); CreateCustomer = new MethodCommand(CreateCust); }
public AgreementListVM() { AgreementDelete = new MethodCommand(DeleteAgreement); OpenAgreementEditWindow = new MethodCommand(AgreementEditWindowOpen); AgreementList = AgreementMethods.ListAgreements(); }