public CandleBodyGeom(DrawingInfo _drawingInfo, int _offset, double[] sortedVals, bool _first, bool upDir) { drawingInfo = _drawingInfo; GeometryGroup bodyGeom = new GeometryGroup(); bodyGeom.Children.Add(new RectangleGeometry(new Rect( new Point(_offset - drawingInfo.candleWidth / 2, sortedVals[1]), new Point(_offset + drawingInfo.candleWidth / 2, sortedVals[2])))); Path bodyPath = new Path(); bodyPath.StrokeThickness = 1; geo.Children.Add(bodyGeom); StrokeThickness = 1; if (_first) { Stroke = Brushes.Red; } else { Stroke = Brushes.Black; } Fill = upDir ? Brushes.White : Brushes.Black; Tag = new CandleTag { first = _first, offset = _offset }; }
private void ScanDirectory(DirectoryInfo dir) { FileInfo[] fis = dir.GetFiles(); foreach (FileInfo fi in fis) { if (fi.Extension.ToLower() == ".dwg" || fi.Extension.ToLower() == ".pdf" || fi.Extension.ToLower() == ".tif" || fi.Extension.ToLower() == ".xls" || fi.Extension.ToLower() == ".xlsx") { var dri = new DrawingInfo(); dri.Name = fi.Name.Substring(0, fi.Name.Length - 4); dri.Path = fi.FullName; dri.Include = true; _drawings.Add(dri); } } if (chkRecursive.IsChecked ?? false) { foreach (DirectoryInfo di in dir.GetDirectories()) { ScanDirectory(di); } } }
public CandleShadowGeom(DrawingInfo _drawingInfo, int _offset, double[] sortedVals, bool _first, bool upDir) { drawingInfo = _drawingInfo; GeometryGroup shadowGeom = new GeometryGroup(); shadowGeom.Children.Add(new LineGeometry( new Point(_offset, sortedVals[0]), new Point(_offset, sortedVals[1]))); shadowGeom.Children.Add(new LineGeometry( new Point(_offset, sortedVals[2]), new Point(_offset, sortedVals[3]))); geo.Children.Add(shadowGeom); StrokeThickness = 1; if (_first) { Stroke = Brushes.Red; } else { Stroke = Brushes.Black; } Tag = new CandleTag { first = _first, offset = _offset }; }
private void DownLoad() { if (dgv1 == null || dgv1.Rows.Count == 0) { return; } string strSourcePath = dgv1.CurrentRow.Cells[11].Value.ToString(); if (strSourcePath.Equals(string.Empty)) { return; } DrawingInfo entry = CommonFunc.GetDrawing(strSourcePath); if (entry == null) { return; } if (!Directory.Exists(entry.SourcePath.Substring(0, entry.SourcePath.LastIndexOf('\\') + 1))) { Directory.CreateDirectory(entry.SourcePath.Substring(0, entry.SourcePath.LastIndexOf('\\') + 1)); } BinaryWriter bw = new BinaryWriter(File.Create(entry.SourcePath)); bw.Write(entry.Context); bw.Close(); MessageBox.Show("下载完毕,文件路径:" + entry.SourcePath); }
private async Task CreateDrawingInfo(string drawingId) { if (!AuthService.IsLoggedIn) { Logger.Error($"Tried creating DrawingInfo ${drawingId} while logged out."); return; } Logger.Info($"Creating DrawingInfo ${drawingId} for user ${AuthService.CurrentUser.DisplayName}"); var drawingInfo = new DrawingInfo() { Id = drawingId, LastModifiedOn = DateTime.Now, IsNsfw = false, Owner = AuthService?.CurrentUser?.Id }; await DatabaseService.Ref(DatabasePaths.DrawingInfo) .Child(drawingId) .Set(drawingInfo); await DatabaseService.Ref(DatabasePaths.Users) .Child(AuthService.CurrentUser.Id) .Child(DatabasePaths.Drawings) .Child(drawingId) .Set(drawingId); }
private void SetDrawingTool(Button selectButton, DrawingTool drawingTool) { if (_drawingTool == drawingTool) { return; } DrawingInfo.SelectFontVisible(drawingTool == DrawingTool.TextTool); Selector.SetIsSelected(_selectedButton, false); _selectedButton = selectButton; Selector.SetIsSelected(_selectedButton, true); _drawingTool = drawingTool; if (drawingTool == DrawingTool.ArrowTool) { DrawingInfo.LeftRadioBtnContent = "箭头"; DrawingInfo.RightRadioBtnContent = "直线"; } else { DrawingInfo.LeftRadioBtnContent = "绘制"; DrawingInfo.RightRadioBtnContent = "填充"; } if (drawingTool == DrawingTool.PenTool && !DrawingInfo.SelectedLeftRadioBtn) { DrawingInfo.RightSliderLblContent = "填充偏离度:"; DrawingInfo.SetLeftSliderRange(0.0, 255.0); } else { DrawingInfo.RightSliderLblContent = "画笔大小:"; DrawingInfo.SetLeftSliderRange(1.0, 20.0); } }
public Chart(DrawingInfo di) { chartLines = new List <ChartLine>(); selectedLines = new List <ChartLine>(); drawingInfo = di; }
public void InputAndOutputWrapping() { var view = new DummyTerminalView(s => new SizeD(s.Length, 1)); var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan); terminal.LineEntered += (s, lea) => terminal.WriteOutput("out: " + lea.Line); terminal.CharsPerLine = m_prompt.Length + 5; "abcdefghijk\r".ForEach(c => terminal.CharTyped(c)); DrawingInfo info = terminal.GetCurrentPageDrawingInfo(50); var lines = CoreTestHelpers.GetLinesAsText(info); Assert.AreEqual(7, lines.Count, "Incorrect number of lines"); Assert.AreEqual(m_prompt + "abcde", lines[0], "Incorrect input line 0"); Assert.AreEqual(m_promptWrap + "fghi", lines[1], "Incorrect input line 1"); Assert.AreEqual(m_promptWrap + "jk", lines[2], "Incorrect input line 2"); Assert.AreEqual(m_promptOutput + "out: ab", lines[3], "Incorrect output line 3"); Assert.AreEqual(m_promptOutputWrap + "cdefgh", lines[4], "Incorrect output line 4"); Assert.AreEqual(m_promptOutputWrap + "ijk", lines[5], "Incorrect output line 5"); Assert.AreEqual(m_prompt, lines[6], "Incorrect input line 6"); }
public Task <Drawing> CreateDrawing(bool isPublic, bool isProtected, SecureString password) { var id = Guid.NewGuid().ToString(); var drawingModel = new DrawingModel() { Height = Constants.DefaultDrawingHeight, Width = Constants.DefaultDrawingWidth, Owner = AuthService.OfflineClientId, IsProtected = isProtected, IsPublic = isPublic, Password = password?.ToUnsecureString() }; var drawingInfo = new DrawingInfo() { Id = id, LastModifiedOn = DateTime.Now, Owner = AuthService.OfflineClientId, PreviewUrl = id, ThumbnailUrl = id + "_thumbnail" }; var drawing = new Drawing(id, drawingModel, AuthService, Cache, Database, Logger); Cache.Write(DatabasePaths.Drawings, drawing.Id, drawingModel); Cache.Write(DatabasePaths.DrawingInfo, drawing.Id, drawingInfo); return(Task.Run(() => drawing)); }
public void RightThroughWrap() { var view = new DummyTerminalView(s => new SizeD(s.Length, 1)); var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan); terminal.LineEntered += (s, lea) => terminal.WriteOutput("out: " + lea.Line); terminal.CharsPerLine = m_prompt.Length + 5; "abcdefghijk".ForEach(c => terminal.CharTyped(c)); terminal.ControlKeyPressed(TerminalKey.Left, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Left, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Left, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Left, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Left, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Left, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Left, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Right, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Right, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Right, TerminalKeyModifiers.None); DrawingInfo info = terminal.GetCurrentPageDrawingInfo(50); var lines = CoreTestHelpers.GetLinesAsText(info, true); Assert.AreEqual(3, lines.Count, "Incorrect number of lines"); Assert.AreEqual(m_prompt + "abcde", lines[0], "Incorrect input line 0"); Assert.AreEqual(m_promptWrap + "fg|hi", lines[1], "Incorrect input line 1"); Assert.AreEqual(m_promptWrap + "jk", lines[2], "Incorrect input line 2"); }
public DataToSerialize SerializeToJson(DrawingInfo drawingInfo) { // dates var P1DT = Misc.PixelToDate(drawingInfo, getP1()); var P2DT = Misc.PixelToDate(drawingInfo, getP2()); // values double P1ValY = Math.Round(Misc.RemapRangePixToVal(getP1().Y, drawingInfo), 6); double P2ValY = Math.Round(Misc.RemapRangePixToVal(getP2().Y, drawingInfo), 6); DataToSerialize toSerialize = new DataToSerialize(); // date + value toSerialize.StartPointDV = P1DT.Item1.ToString(Data.dateTimeFormat) + "+" + P1DT.Item2.ToString(Data.numberFormat) + ";" + P1ValY.ToString(Data.numberFormat); toSerialize.EndPointDV = P2DT.Item1.ToString(Data.dateTimeFormat) + "+" + P2DT.Item2.ToString(Data.numberFormat) + ";" + P2ValY.ToString(Data.numberFormat); toSerialize.Color = Misc.BrushToString(color); // default layer is L1 if (layerData == "") { layerData = "L1"; } toSerialize.Data = layerData; return(toSerialize); }
public void UpShowsPreviousInHistory_CantGoPastFirst() { var view = new DummyTerminalView(s => new SizeD(s.Length, 1)); var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan); terminal.LineEntered += (s, lea) => terminal.WriteOutput("out: " + lea.Line); terminal.CharsPerLine = m_prompt.Length + 5; "aa\r".ForEach(c => terminal.CharTyped(c)); "bb\r".ForEach(c => terminal.CharTyped(c)); "cc\r".ForEach(c => terminal.CharTyped(c)); "dd".ForEach(c => terminal.CharTyped(c)); //current line terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Up, TerminalKeyModifiers.None); DrawingInfo info = terminal.GetCurrentPageDrawingInfo(50); var lines = CoreTestHelpers.GetLinesAsText(info); Assert.AreEqual(m_prompt + "aa", lines[lines.Count - 1], "Last line should now show first command"); }
private void btnView_Click(object sender, EventArgs e) { long FileSize; byte[] Context; string SourcePath, FileName, FileSuffix; OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "选择文件"; ofd.Filter = "图纸(*.cut)|*.cut|所有文件(*.*)|*.*"; if (ofd.ShowDialog() == DialogResult.OK) { SourcePath = ofd.FileName; FileStream fs = new FileStream(SourcePath, FileMode.Open); BinaryReader br = new BinaryReader(fs); Context = br.ReadBytes(Convert.ToInt32(fs.Length)); FileName = SourcePath.Substring(SourcePath.LastIndexOf("\\") + 1); FileSuffix = FileName.Substring(FileName.IndexOf(".") + 1); FileSize = fs.Length; fs.Close(); _Entry = new DrawingInfo(_PID, 0, "", SourcePath, FileName, FileSuffix, FileSize, UserSetting.UserInf.UserName, DateTime.Now, false, false, "修改-图纸替换", Context); } }
/// <summary> /// Конструктор /// </summary> public PictureCtrl(Size size, dGetBscanPart getBscanPart, StatusStrip statusBar, MarksManagerClass marksMgr, Action zoomCheck, List<string> ascansGps) { InitializeComponent(); drawingInfo = new DrawingInfo(); SetPictureCtrlProperties(size, getBscanPart, statusBar, marksMgr, zoomCheck, ascansGps); PictureCoords.Instance.RefreshPicCoords(Width, Height, _bscanLength, _maxAscanLength); ShiftPanelError(); }
internal void SetDrawingInfo(DrawingInfo drawingInfo) { mContributorsView.SetDrawingInfo(drawingInfo); mResultView.SetDrawingInfo(drawingInfo); mDeclarationSynchronizer.SetDeclarationMappings(drawingInfo.DeclarationMappings); UpdateVirtualMapping(drawingInfo.Mapping); }
/// <summary> /// 批量上传图纸 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsmiTool_batchImport_Click(object sender, EventArgs e) { long FileSize; byte[] Context; string[] arrSourcePath; string FileDir, FileName, FileSuffix, strError = string.Empty; DrawingInfo entry; FolderBrowserDialog fbd = new FolderBrowserDialog(); if (fbd.ShowDialog() == DialogResult.OK) { FileDir = fbd.SelectedPath; arrSourcePath = Directory.GetFiles(FileDir, "*.cut", SearchOption.AllDirectories); FileStream fs; BinaryReader br; foreach (string SourcePath in arrSourcePath) { fs = new FileStream(SourcePath, FileMode.Open); br = new BinaryReader(fs); Context = br.ReadBytes(Convert.ToInt32(fs.Length)); FileName = SourcePath.Substring(SourcePath.LastIndexOf("\\") + 1); FileSuffix = FileName.Substring(FileName.IndexOf(".") + 1); FileSize = fs.Length; fs.Close();//? entry = new DrawingInfo(0, 0, "", SourcePath, FileName, FileSuffix, FileSize, "System", DateTime.Now, false, false, "批量导入", Context); try { CommonFunc.UpLoadDrawing(entry); } catch (Exception ex) { strError += "|" + ex.Message; } } } else { return; } if (strError != string.Empty) { MessageBox.Show("部分上传失败:" + strError); return; } else { MessageBox.Show("全部上传成功。"); return; } }
public HelperLineGeom(DrawingInfo _drawingInfo) { drawingInfo = _drawingInfo; geo.Children.Add(new LineGeometry()); Visibility = Visibility.Hidden; StrokeThickness = 1; Stroke = Brushes.Black; }
public FrameGeom(DrawingInfo drawingInfo) { frameGeom.Children.Add(new RectangleGeometry(new Rect( new Point(drawingInfo.viewMarginLeft, drawingInfo.viewMarginTop), new Point(drawingInfo.viewWidth - drawingInfo.viewMarginRight, drawingInfo.viewHeight - drawingInfo.viewMarginBottom)))); StrokeThickness = 1; Stroke = Brushes.Black; this.drawingInfo = drawingInfo; }
// Create webmap layer out of a feature set from a query task private async Task <WebMapLayer> CreateFeatureCollectionLayer() { try { //Perform Query to get a featureSet and add to webmap as featurecollection QueryTask qt = new QueryTask( new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/MapServer/0")); Esri.ArcGISRuntime.Tasks.Query.Query query = new Esri.ArcGISRuntime.Tasks.Query.Query("magnitude > 3.5"); query.OutFields.Add("*"); query.ReturnGeometry = true; var queryResult = await qt.ExecuteAsync(query); var simpleRenderer = new SimpleRenderer { Symbol = new SimpleMarkerSymbol { Style = SimpleMarkerStyle.Circle, Color = Color.FromArgb(255, 0, 0, 255), Size = 8 } }; var drawingInfo = new DrawingInfo { Renderer = simpleRenderer }; var layerDefinition = new LayerDefinition { DrawingInfo = drawingInfo }; //Create FeatureCollection as webmap layer FeatureCollection featureCollection = null; if (queryResult.FeatureSet.Features.Count > 0) { var sublayer = new WebMapSubLayer(); sublayer.Id = 0; sublayer.FeatureSet = queryResult.FeatureSet; sublayer.LayerDefinition = layerDefinition; featureCollection = new FeatureCollection { SubLayers = new List <WebMapSubLayer> { sublayer } }; } return(new WebMapLayer { FeatureCollection = featureCollection, Title = "Earthquakes from last 7 days" }); } catch (Exception ex) { var _ = new MessageDialog(ex.Message, "Sample Error").ShowAsync(); return(null); } }
private void OnDraw(DrawingInfo info) { if (info is BrushDrawingInfo) { var brushInfo = info as BrushDrawingInfo; OnDrawPoints(brushInfo.points); } else if (info is LassoDrawingInfo) { var lassoInfo = info as LassoDrawingInfo; OnDrawArea(lassoInfo.points, lassoInfo.min, lassoInfo.max); } }
public void Play(DrawingInfo info) { Info = info; if (TapPoints.Count != Info.Clips.Count) { Debug.LogWarning("Tap points don't match audio clip count!: " + TapPoints + " taps != " + Info.Clips.Count + " clips."); } Zoomer.RateModifier = 1f/TapPointsVisible; for (int i = 0; i < TapPoints.Count; i++) { TapPoints[i].SetTap(i < TapPointsVisible, info.Icons[i]); } }
private void OnDrawArea(DrawingInfo info) { var lassoInfo = info as LassoDrawingInfo; var areaInfo = areaInfos[areaInspector.AreaInspectionCount]; int count = areaInspector.CreatedAreaInspectionCount + 1; areaInspector.CreateAreaInspection(areaInfo, count, inspectionPrefab, inspectorContainer); areaInspector.CreateArea(areaInfo, count, linePrefab, lassoInfo.points); AddAreaInspection(); createAreaInspectionToggle.isOn = false; SetCursorTexture(cursorDefault); }
public static bool LineValueOnSdd(ChartLine line, Data.SymbolDayData sdd) { DrawingInfo di = line.GetDrawingInfo(); double PDR = DateToPixel(di, sdd.Date, 0); double PVRLO = Math.Round(RemapRangeValToPix(sdd.Low, di), 6); double PVRHI = Math.Round(RemapRangeValToPix(sdd.Hi, di), 6); Point pLO = new Point(PDR, PVRLO); Point pHI = new Point(PDR, PVRHI); return(DoIntersect(line.getP1(), line.getP2(), pLO, pHI)); }
public void EscClearsCurrentLine() { var view = new DummyTerminalView(s => new SizeD(s.Length, 1)); var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan); terminal.CharsPerLine = m_prompt.Length + 5; "abcdefghlakdgj;lkdjglkjd;lgkj;dslkjg;lds".ForEach(c => terminal.CharTyped(c)); terminal.CharTyped('\x1B'); DrawingInfo info = terminal.GetCurrentPageDrawingInfo(4); var lines = CoreTestHelpers.GetLinesAsText(info); Assert.AreEqual(1, lines.Count, "Incorrect number of lines"); Assert.AreEqual(m_prompt, lines[0], "Incorrect input line 0"); }
public void SingleLine() { var view = new DummyTerminalView(s => new SizeD(s.Length, 1)); var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan); terminal.CharsPerLine = 10; "ab".ForEach(c => terminal.CharTyped(c)); DrawingInfo info = terminal.GetCurrentPageDrawingInfo(5); var lines = CoreTestHelpers.GetLinesAsText(info); Assert.AreEqual(1, lines.Count, "Incorrect number of lines"); Assert.AreEqual(m_prompt + "ab", lines[0]); }
public void DrawAll(DrawContext context, IDrawSmoothProvider sp) { Debug.Assert(IsSorted); // <- Expect our caller to have sorted! int vertexCount = this.Count; for (int i = vertexCount - 1; i >= 0; i--) // The topological sort returns in front-to-back order { DrawingInfo di = drawingInfo[sortedOrder[i]]; #if DEBUG CheckAllowedToDraw(di.drawObject, di.tag); #endif di.drawObject.Draw(context, di.tag, sp); } }
public static Point LineStringToPoint(DrawingInfo drawingInfo, string dataDV) { char[] separators = new char[] { '+', ';' }; string[] PDV = dataDV.Split(separators); // value double PV = double.Parse(PDV[2], Data.numberFormat); double PVR = Math.Round(RemapRangeValToPix(PV, drawingInfo), 6); // date DateTime PD = DateTime.ParseExact(PDV[0], Data.dateTimeFormat, System.Globalization.CultureInfo.InvariantCulture); double PDf = double.Parse(PDV[1], Data.numberFormat); // factor double PDR = DateToPixel(drawingInfo, PD, PDf); return(new Point(PDR, PVR)); }
private void DrawingInfo_SelectedRadioChanged(object sender, EventArgs e) { if (_drawingTool != DrawingTool.PenTool) { return; } if (DrawingInfo.SelectedLeftRadioBtn) { DrawingInfo.RightSliderLblContent = "画笔大小:"; DrawingInfo.SetLeftSliderRange(1.0, 20.0); } else { DrawingInfo.RightSliderLblContent = "填充偏离度:"; DrawingInfo.SetLeftSliderRange(0.0, 255.0); } }
public void Left() { var view = new DummyTerminalView(s => new SizeD(s.Length, 1)); var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan); terminal.LineEntered += (s, lea) => terminal.WriteOutput("out: " + lea.Line); terminal.CharsPerLine = m_prompt.Length + 5; "abcd".ForEach(c => terminal.CharTyped(c)); terminal.ControlKeyPressed(TerminalKey.Left, TerminalKeyModifiers.None); terminal.ControlKeyPressed(TerminalKey.Left, TerminalKeyModifiers.None); DrawingInfo info = terminal.GetCurrentPageDrawingInfo(50); var lines = CoreTestHelpers.GetLinesAsText(info, true); Assert.AreEqual(m_prompt + "ab|cd", lines[lines.Count - 1], "Left navigation failed"); }
public void Backspace() { var view = new DummyTerminalView(s => new SizeD(s.Length, 1)); var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan); terminal.LineEntered += (s, lea) => terminal.WriteOutput("out: " + lea.Line); terminal.CharsPerLine = m_prompt.Length + 5; "abcd".ForEach(c => terminal.CharTyped(c)); terminal.CharTyped('\b'); terminal.CharTyped('\b'); DrawingInfo info = terminal.GetCurrentPageDrawingInfo(50); var lines = CoreTestHelpers.GetLinesAsText(info); Assert.AreEqual(m_prompt + "ab", lines[lines.Count - 1], "Backspace should have deleted the text"); }
public void InputWrapping() { var view = new DummyTerminalView(s => new SizeD(s.Length, 1)); var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan); terminal.CharsPerLine = m_prompt.Length + 5; "abcdefghijk".ForEach(c => terminal.CharTyped(c)); DrawingInfo info = terminal.GetCurrentPageDrawingInfo(5); var lines = CoreTestHelpers.GetLinesAsText(info); Assert.AreEqual(3, lines.Count, "Incorrect number of lines"); Assert.AreEqual(m_prompt + "abcde", lines[0], "Incorrect input line"); Assert.AreEqual(m_promptWrap + "fghi", lines[1], "Incorrect input line"); Assert.AreEqual(m_promptWrap + "jk", lines[2], "Incorrect input line"); }
public void AfterReturnTypeOutputAndNextInputLineShow() { var view = new DummyTerminalView(s => new SizeD(s.Length, 1)); var terminal = new TerminalController(view, new SizeD(1, 1), int.MaxValue, m_promptSpan, m_promptWrapSpan, m_promptOutputSpan, m_promptOutputWrapSpan); terminal.LineEntered += (s, lea) => terminal.WriteOutput("out: " + lea.Line); terminal.CharsPerLine = 10; "ab\r".ForEach(c => terminal.CharTyped(c)); DrawingInfo info = terminal.GetCurrentPageDrawingInfo(5); var lines = CoreTestHelpers.GetLinesAsText(info); Assert.AreEqual(3, lines.Count, "Incorrect number of lines"); Assert.AreEqual(m_prompt + "ab", lines[0], "Incorrect input line"); Assert.AreEqual(m_promptOutput + "out: ab", lines[1], "Incorrect outline"); Assert.AreEqual(m_prompt, lines[2], "Incorrect next input line"); }
private void textBox1_TextChanged(object sender, EventArgs e) { var model = sldWorks.ActiveDoc as ModelDoc2; var isDrawing = model is DrawingDoc; if (!isDrawing) { return; } var drawingInfo = DrawingInfo.Parse(activeDocTitleBox.Text); if (drawingInfo == null) { return; } prefixTextBox.Text = string.Format("{0} {1} PT", drawingInfo.JobNo, drawingInfo.DrawingNo); prefixTextBox.SelectionStart = prefixTextBox.Text.Length; }
/// <summary> /// NB: This code creates a point feature service if nothing has been selected in the "My Feature Services Info -> Items combobox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddDefinitionToLayer_Click(object sender, EventArgs e) { Item item = null; Extent extent = null; Symbol symbol = null; Renderer renderer = null; DrawingInfo drawingInfo = null; object[] fields = null; Template template = null; EditorTrackingInfo editorTrackingInfo = null; AdminLayerInfoAttribute adminLayerInfo = null; DefinitionLayer layer = null; string formattedRequest = string.Empty; string jsonResponse = string.Empty; FeatureLayerAttributes featLayerAttributes = null; this.Cursor = Cursors.WaitCursor; //NB: From the Items combobox if you have a feature service selected, this is the attribute table structure that will be used for the //creation of the new service. Otherwise create a new featureLayerAttributes class as set up in this code. // if (chkbxUseSelectedFS.Checked) { string[] concatenatedText = cboItems.Text.Split(':'); string split = concatenatedText[1].Replace(" ID", ""); if (_myOrganizationalContent.TryGetValue(cboItems.Text, out item)) if(item != null) if(item.url != null) featLayerAttributes = RequestAndResponseHandler.GetFeatureServiceAttributes(item.url, _token, out formattedRequest, out jsonResponse); try { if (featLayerAttributes == null) _featureServiceAttributesDataDictionary.TryGetValue(split.Trim(), out _featureLayerAttributes); } catch { } } if (featLayerAttributes == null) if (_featureLayerAttributes != null) featLayerAttributes = _featureLayerAttributes; else featLayerAttributes = new FeatureLayerAttributes(); //ensure that we have all that we need for a successful feature layer attributes push // if(featLayerAttributes.extent != null) extent = featLayerAttributes.extent; else { //write in your default extent values here: extent = new Extent() { xmin = -14999999.999999743, ymin = 1859754.5323447795, xmax = -6199999.999999896, ymax = 7841397.327701188, spatialReference = new SpatialReference() { wkid = 102100, latestWkid = 3857 }, }; } if (featLayerAttributes.drawingInfo != null) drawingInfo = featLayerAttributes.drawingInfo; else { symbol = new PointSymbol() { type = "esriPMS", url = "RedSphere.png", imageData = "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAC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48pj9gLe4SNG9QoGGLAk8z5XiaJUd99u8122/IpBA2K9BGg2vWWKAvRYVeLzEa7E1R422m2+MsSTem97nSYnfKyN6/mzATv7AUgqcMrUnmaFlLX3ysM0fj+t/b5lQLtK22QEfyAmiSLKFZpUJ7kBRPXKW4HqCYynWVHKSG2LkyZex1uO1mZM9lKem9Tx9jjY5iNEYo0bKMhn7ZAu0r6H5PpLXCAq0rKJClSjSGynE/QIkrQYqBPe6S2X+AJsY2Ped6iWZk6RlL0c2r5szofRsO9R5S1IfQLRCpQL1aifoYFerpsbkuTImaUJXuXIDiH6/Ys8vm3Mg8L2i20YqsO7fItKLcSXyn0kXccclVqv3MS6at9JU/Ox+ouns+SF6Z4cSupz7l8+z1ucs7LF1AQjOdxfGZzmx8Iu1TRcfnrioICAQEAgIBgYBAQCAgEBAICAQEAgIBgYBAQCAgEBAICAQEAv8H44b/6ZiGvGAAAAAASUVORK5CYII=", contentType = "image/png", color = null, width = 15, height = 15, angle = 0, xoffset = 0, yoffset = 0 }; renderer = new PointRenderer() { type = "simple", symbol = symbol, label = "", description = "" }; drawingInfo = new DrawingInfo() { renderer = renderer, labelingInfo = null }; } if (featLayerAttributes.fields != null) fields = featLayerAttributes.fields; else { Field field = new Field() { name = "Longitude", type = "esriFieldTypeDouble", alias = "Longitude", sqlType = "sqlTypeFloat", nullable = true, editable = true, domain = null, defaultValue = null }; Field field2 = new Field() { name = "Latitude", type = "esriFieldTypeDouble", alias = "Latitude", sqlType = "sqlTypeFloat", nullable = true, editable = true, domain = null, defaultValue = null }; FieldString field3 = new FieldString() { name = "Name", type = "esriFieldTypeString", alias = "Name", sqlType = "sqlTypeNVarchar", length = 256, nullable = true, editable = true, domain = null, defaultValue = null }; FieldString field4 = new FieldString() { name = "Address", type = "esriFieldTypeString", alias = "Address", sqlType = "sqlTypeNVarchar", length = 256, nullable = true, editable = true, domain = null, defaultValue = null }; //DO NOT CHANGE PROPERTIES BELOW Field fieldFID = new Field() { name = "FID", type = "esriFieldTypeInteger", alias = "FID", sqlType = "sqlTypeInteger", nullable = false, editable = false, domain = null, defaultValue = null }; //object array so that we can contain different types within. //Field type double for example does not contain a length parameter. Hence we need different field type //representation. Unexpected properties for data types will cause a failure on the server end. fields = new object[5] { field, field2, field3, field4, fieldFID }; } if (featLayerAttributes.templates != null) template = featLayerAttributes.templates[0]; else { template = new Template() { name = "New Feature", description = "", drawingTool = "esriFeatureEditToolPoint", prototype = new Prototype() { attributes = new Attributes() } }; } editorTrackingInfo = new EditorTrackingInfo() { enableEditorTracking = false, enableOwnershipAccessControl = false, allowOthersToUpdate = true, allowOthersToDelete = true }; adminLayerInfo = new AdminLayerInfoAttribute() { geometryField = new GeometryField() { name = "Shape", srid = 102100 } }; layer = new DefinitionLayer() { currentVersion = featLayerAttributes != null ? featLayerAttributes.currentVersion : 10.11, id = 0, name = featLayerAttributes != null ? featLayerAttributes.name != null ? featLayerAttributes.name : txtFeatureServiceName.Text : txtFeatureServiceName.Text, type = featLayerAttributes != null ? featLayerAttributes.type != null ? featLayerAttributes.type : "Feature Layer" : "Feature Layer", displayField = featLayerAttributes != null ? featLayerAttributes.displayField != null ? featLayerAttributes.displayField : "" : "", description = "", copyrightText = featLayerAttributes != null ? featLayerAttributes.copyrightText != null ? featLayerAttributes.copyrightText : "" : "", defaultVisibility = featLayerAttributes != null ? featLayerAttributes.defaultVisibility != null ? featLayerAttributes.defaultVisibility : true : true, relationships = featLayerAttributes != null ? featLayerAttributes.relationShips != null ? featLayerAttributes.relationShips : new object[]{} : new object[] { }, isDataVersioned = featLayerAttributes != null ? featLayerAttributes.isDataVersioned : false, supportsRollbackOnFailureParameter = true, supportsAdvancedQueries = true, geometryType = featLayerAttributes != null ? featLayerAttributes.geometryType != null ? featLayerAttributes.geometryType : "esriGeometryPoint" : "esriGeometryPoint", minScale = featLayerAttributes != null ? featLayerAttributes.minScale : 0, maxScale = featLayerAttributes != null ? featLayerAttributes.maxScale : 0, extent = extent, drawingInfo = _javaScriptSerializer.Serialize(drawingInfo), allowGeometryUpdates = featLayerAttributes != null ? featLayerAttributes.allowGeometryUpdates != null ? featLayerAttributes.allowGeometryUpdates : true : true, hasAttachments = featLayerAttributes != null ? featLayerAttributes.hasAttachments : false, htmlPopupType = featLayerAttributes != null ? featLayerAttributes.htmlPopupType != null ? featLayerAttributes.htmlPopupType : "esriServerHTMLPopupTypeNone" : "esriServerHTMLPopupTypeNone", hasM = featLayerAttributes != null ? featLayerAttributes.hasM : false, hasZ = featLayerAttributes != null ? featLayerAttributes.hasZ : false, objectIdField = featLayerAttributes != null ? featLayerAttributes.objectIdField != null ? featLayerAttributes.objectIdField : "FID" : "FID", globalIdField = featLayerAttributes != null ? featLayerAttributes.globalIdField != null ? featLayerAttributes.globalIdField : "" : "", typeIdField = featLayerAttributes != null ? featLayerAttributes.typeIdField != null ? featLayerAttributes.typeIdField : "" : "", fields = fields, types = featLayerAttributes != null ? featLayerAttributes.types != null ? featLayerAttributes.types : new object[0] : new object[0], templates = new Template[1] { template }, supportedQueryFormats = featLayerAttributes != null ? featLayerAttributes.supportedQueryFormats != null ? featLayerAttributes.supportedQueryFormats: "JSON" : "JSON", hasStaticData = featLayerAttributes != null ? featLayerAttributes.hasStaticData : false, maxRecordCount = 2000,//featLayerAttributes != null ? featLayerAttributes.maxRecordCount != null ? featLayerAttributes.maxRecordCount : 200000 : 200000, capabilities = featLayerAttributes != null ? featLayerAttributes.capabilities != null ? featLayerAttributes.capabilities : "Query,Editing,Create,Update,Delete" : "Query,Editing,Create,Update,Delete", //editorTrackingInfo = editorTrackingInfo, adminLayerInfo = adminLayerInfo }; DefinitionLayer[] layers = new DefinitionLayer[1] { layer }; AddDefinition definition = new AddDefinition() { layers = layers }; string serviceEndPoint = "http://services1.arcgis.com/"; //NB: Trial Account endpoint!!!! string serviceEndPoint2 = "http://services.arcgis.com/"; string requestURL = string.Format("{0}{1}/arcgis/admin/services/{2}.FeatureServer/AddToDefinition", serviceEndPoint, _organizationID, _featureServiceCreationResponse.Name); bool b = RequestAndResponseHandler.AddToFeatureServiceDefinition(requestURL, definition, _token, txtOrgURL.Text, out formattedRequest, out jsonResponse); if (!b) { requestURL = string.Format("{0}{1}/arcgis/admin/services/{2}.FeatureServer/AddToDefinition", serviceEndPoint2, _organizationID, _featureServiceCreationResponse.Name); b = RequestAndResponseHandler.AddToFeatureServiceDefinition(requestURL, definition, _token, txtOrgURL.Text, out formattedRequest, out jsonResponse); } ShowRequestResponseStrings(formattedRequest, jsonResponse); lblSuccess.Text = b == true ? "true" : "false"; this.Cursor = Cursors.Default; }
private void ImgLayerView_ApplyTapped(object sender, ImageLayerViewEventArgs<UIImage> e) { this.imgLayerView.ApplyTapped -= ImgLayerView_ApplyTapped; this.imgLayerView.CancelTapped -= ImgLayerView_CancelTapped; this.imgLayerView.DeleteTapped -= ImgLayerView_DeleteTapped; // The new image is added to a new layer DrawingInfo drawingInfo = null; if (e.DrawingType == DrawingLayerType.Image) { drawingInfo = new DrawingInfo (0, e.Image, e.ImageFrame); } else if (e.DrawingType == DrawingLayerType.Comix || e.DrawingType == DrawingLayerType.Stamp) { drawingInfo = new DrawingInfo (0, e.ContentPackItemID, e.DrawingType, e.Image, e.ImageFrame, null); } else if (e.DrawingType == DrawingLayerType.Callout) { drawingInfo = new DrawingInfo (0, e.ContentPackItemID, e.DrawingType, e.Image, e.ImageFrame, this.Brush.BrushColor); drawingInfo.CalloutTextRect = AnimationUtils.GetCalloutTextRect (drawingInfo.ImageFrame, ContentPackItem.ItemSize.Small); }//end if else if if (null != this.DrawingItemCreated) { this.DrawingItemCreated (this, new DrawingInfoCreatedEventArgs (drawingInfo)); }//end if this.imgLayerView.RemoveFromSuperview (); this.userDraw = true; }
private void DrawOnePoint(PointF prevPoint, PointF currentPoint, DrawingInfo drawingInfo) { UIGraphics.BeginImageContextWithOptions (this.Bounds.Size, false, UIScreen.MainScreen.Scale); using (CGContext context = UIGraphics.GetCurrentContext()) { if (null != this.imgDrawDisplay.Image) { this.imgDrawDisplay.Image.Draw (this.Bounds); }//end if context.InterpolationQuality = CGInterpolationQuality.None; context.SetAllowsAntialiasing (false); context.SetLineCap (CGLineCap.Round); context.SetLineJoin (CGLineJoin.Round); if (drawingInfo.Brush.BrushType == BrushType.Normal) { context.SetStrokeColor (drawingInfo.LineColor); context.SetLineWidth (drawingInfo.Brush.Thickness); context.MoveTo (prevPoint.X, prevPoint.Y); PointF midPoint = new PointF ((prevPoint.X + currentPoint.X) / 2f, (prevPoint.Y + currentPoint.Y) / 2f); context.AddCurveToPoint (prevPoint.X, prevPoint.Y, midPoint.X, midPoint.Y, currentPoint.X, currentPoint.Y); context.DrawPath (CGPathDrawingMode.Stroke); } else { if (!drawingInfo.Brush.IsSprayBrushActive) { drawingInfo.Brush.SetBrushActive (true); }//end if SizeF brushImageSize = drawingInfo.Brush.BrushImage.Size; RectangleF rect = new RectangleF (currentPoint.X - (brushImageSize.Width / 2f), currentPoint.Y - (brushImageSize.Height / 2f), brushImageSize.Width, brushImageSize.Height); drawingInfo.Brush.BrushImage.Draw (rect.Location); }//end if else if (null != this.imgDrawDisplay.Image) { this.imgDrawDisplay.Image.Dispose (); }//end if this.imgDrawDisplay.Image = UIGraphics.GetImageFromCurrentImageContext (); }//end using context UIGraphics.EndImageContext (); }
// Create webmap layer out of a feature set from a query task private async Task<WebMapLayer> CreateFeatureCollectionLayer() { try { //Perform Query to get a featureSet and add to webmap as featurecollection QueryTask qt = new QueryTask( new Uri("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/MapServer/0")); Esri.ArcGISRuntime.Tasks.Query.Query query = new Esri.ArcGISRuntime.Tasks.Query.Query("magnitude > 3.5"); query.OutFields.Add("*"); query.ReturnGeometry = true; var queryResult = await qt.ExecuteAsync(query); var simpleRenderer = new SimpleRenderer { Symbol = new SimpleMarkerSymbol { Style = SimpleMarkerStyle.Circle, Color = Color.FromArgb(255, 0, 0, 255), Size = 8 } }; var drawingInfo = new DrawingInfo { Renderer = simpleRenderer }; var layerDefinition = new LayerDefinition {DrawingInfo = drawingInfo}; //Create FeatureCollection as webmap layer FeatureCollection featureCollection = null; if (queryResult.FeatureSet.Features.Count > 0) { var sublayer = new WebMapSubLayer(); sublayer.Id = 0; sublayer.FeatureSet = queryResult.FeatureSet; sublayer.LayerDefinition = layerDefinition; featureCollection = new FeatureCollection { SubLayers = new List<WebMapSubLayer> { sublayer } }; } return new WebMapLayer { FeatureCollection = featureCollection, Title = "Earthquakes from last 7 days" }; } catch (Exception ex) { MessageBox.Show(ex.Message, "Sample Error"); return null; } }