public void GetPictureFromMapTest() { PreviewMap target = new PreviewMap(); // TODO: Initialize to an appropriate value target.GetPictureFromMap(); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void UpdateTest() { MapWindow.Interfaces.PreviewMap target = new PreviewMap(); // TODO: Initialize to an appropriate value MapWindow.Interfaces.ePreviewUpdateExtents UpdateExtents = new MapWindow.Interfaces.ePreviewUpdateExtents(); // TODO: Initialize to an appropriate value target.Update(UpdateExtents); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void UpdateLocatorBoxTest() { PreviewMap target = new PreviewMap(); // TODO: Initialize to an appropriate value target.UpdateLocatorBox(); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
private static ViewDrafting DuplicateDraftingViews(PreviewMap previewMap) { ViewDrafting viewDrafting = null; try { Document fromDoc = previewMap.SourceModelInfo.Doc; Document toDoc = previewMap.RecipientModelInfo.Doc; ViewDrafting sourceView = previewMap.SourceViewProperties.ViewDraftingObj; ICollection <ElementId> referenceCalloutIds = sourceView.GetReferenceCallouts(); CopyPasteOptions options = new CopyPasteOptions(); options.SetDuplicateTypeNamesHandler(new HideAndAcceptDuplicateTypeNamesHandler()); ICollection <ElementId> copiedIds = null; using (Transaction transaction = new Transaction(toDoc, "Duplicate Draftingviews")) { transaction.Start(); try { List <ElementId> viewIds = new List <ElementId>(); viewIds.Add(sourceView.Id); //view-specific item copiedIds = ElementTransformUtils.CopyElements(fromDoc, viewIds, toDoc, Transform.Identity, options); FailureHandlingOptions failureOptions = transaction.GetFailureHandlingOptions(); failureOptions.SetFailuresPreprocessor(new HidePasteDuplicateTypesPreprocessor()); transaction.Commit(failureOptions); } catch (Exception ex) { string message = ex.Message; transaction.RollBack(); } } if (null != copiedIds) { ElementId viewId = copiedIds.First(); ViewDrafting copiedView = toDoc.GetElement(viewId) as ViewDrafting; if (null != copiedView) { int numOfCopied = DuplicateDetailingAcrossViews(sourceView, copiedView); } if (referenceCalloutIds.Count > 0) { bool placedCallout = DuplicateReferenceCallouts(sourceView, copiedView); } viewDrafting = copiedView; } } catch (Exception ex) { errorMessage.AppendLine(previewMap.SourceViewProperties.ViewName + ": errors in duplicating drafting views.\n" + ex.Message); //MessageBox.Show("Failed to duplicate drafintg views.\n" + ex.Message, "Duplicate DraftingViews", MessageBoxButton.OK, MessageBoxImage.Warning); } return(viewDrafting); }
public void DrawBoxTest() { PreviewMap target = new PreviewMap(); // TODO: Initialize to an appropriate value Rectangle rect = new Rectangle(); // TODO: Initialize to an appropriate value target.DrawBox(rect); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public void BackColorTest() { PreviewMap target = new PreviewMap(); // TODO: Initialize to an appropriate value Color expected = new Color(); // TODO: Initialize to an appropriate value Color actual; target.BackColor = expected; actual = target.BackColor; Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void GetPictureFromFileTest() { PreviewMap target = new PreviewMap(); // TODO: Initialize to an appropriate value string Filename = string.Empty; // TODO: Initialize to an appropriate value bool expected = false; // TODO: Initialize to an appropriate value bool actual; actual = target.GetPictureFromFile(Filename); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
private void CreateMaps() { falloffMap = MapGenerator.GenerateFalloffMap(mapWidth, currentFalloffMapSettings); heightMap = MapGenerator.GenerateHeightMap(mapWidth, mapHeight, currentHeightMapSettings, falloffMap, Vector2.zero); treeBiomeMap = MapGenerator.GenerateBiomeMap(clutterMapWidth, clutterMapWidth, currentTreeBiomeMapSettings, Vector2.zero, true); rockBiomeMap = MapGenerator.GenerateBiomeMap(clutterMapWidth, clutterMapWidth, currentRockBiomeMapSettings, Vector2.zero, true); treeClutterMap = MapGenerator.GenerateClutterMap(clutterMapWidth, clutterMapWidth, currentTreeMapSettings, Vector2.zero, treeBiomeMap, true); rockClutterMap = MapGenerator.GenerateClutterMap(clutterMapWidth, clutterMapWidth, currentRockMapSettings, Vector2.zero, rockBiomeMap, true); previewMap = MapGenerator.GeneratePreviewMap(mapWidth, mapHeight, worldMinHeight, worldMaxHeight, previewSettings, heightMap, currentTextureSettings /*, new ClutterMap[] { rockClutterMap, treeClutterMap }*/); //treeBiomeMapSeed = currentTreeBiomeMapSettings.noiseSettings.seed; //rockBiomeMapSeed = currentRockBiomeMapSettings.noiseSettings.seed; //treeMapSeed = currentTreeMapSettings.noiseSettings.seed; //rockMapSeed = currentRockMapSettings.noiseSettings.seed; }
private static PreviewMap UpdatePreviewMap(PreviewMap previewMap, ViewDrafting copiedView) { PreviewMap preview = previewMap; try { if (null != copiedView) { ViewProperties vp = new ViewProperties(preview.RecipientModelInfo.Doc, copiedView); vp.Status = LinkStatus.Linked; vp.LinkedView = preview.SourceViewProperties; preview.RecipientViewProperties = vp; preview.SourceViewProperties.Status = LinkStatus.Linked; preview.SourceViewProperties.LinkedView = preview.RecipientViewProperties; LinkInfo linkInfo = new LinkInfo(); linkInfo.ItemType = LinkItemType.DraftingView; linkInfo.SourceModelName = preview.SourceModelInfo.DocTitle; linkInfo.SourceModelPath = preview.SourceModelInfo.DocCentralPath; linkInfo.SourceModelId = preview.SourceModelInfo.RevitDocumentID; linkInfo.SourceItemId = preview.SourceViewProperties.ViewId; linkInfo.SourceItemName = preview.SourceViewProperties.ViewName; linkInfo.DestModelName = preview.RecipientModelInfo.DocTitle; linkInfo.DestModelPath = preview.RecipientModelInfo.DocCentralPath; linkInfo.DestItemId = preview.RecipientViewProperties.ViewId; linkInfo.DestItemName = preview.RecipientViewProperties.ViewName; linkInfo.LinkModified = DateTime.Now.ToString("G"); linkInfo.LinkModifiedBy = Environment.UserName; preview.ViewLinkInfo = linkInfo; } } catch (Exception ex) { errorMessage.AppendLine("Failed to udpate the information of preview map.\n" + ex.Message); //MessageBox.Show("Failed to update the information of preview map.\n"+ex.Message, "Update Preview Map", MessageBoxButton.OK, MessageBoxImage.Warning); } return(preview); }
void UpdateExecute(CancellationToken ct) { if (Value == null || Data == null || ct.IsCancellationRequested) { return; } var val = Value; bool noChanges = val.Value == NewValue; bool filterEmpty = true; if (UseFormat) { try { filterEmpty = string.IsNullOrWhiteSpace(string.Format(Format, string.Empty)); } catch { } } var previwCount = MainVM.Instance.PreviewLines / 2; var map = new PreviewMap(Data.Text); Count = 0; List <UIElement> previews = new List <UIElement>(); foreach (var item in Data.Items) { if (ct.IsCancellationRequested) { return; } var itm = item as IMapValueItem; if (itm != null && itm.Value == val.Value) { Count++; string nVal = string.Empty; try { nVal = string.Format(UseFormat ? Format : "{0}", noChanges ? UseFormat ? itm.NewValue(itm.Value) : string.Empty : itm.NewValue(NewValue)); } catch { } var previewData = MakePreview(map, itm, previwCount, nVal); var stack = new StackPanel() { HorizontalAlignment = HorizontalAlignment.Right, Orientation = Orientation.Horizontal }; if (!noChanges || !filterEmpty) { var btnApply = new Button() { Style = addBtn, DataContext = previewData.Item2, Content = new System.Windows.Shapes.Path() { Data = apply, Fill = Brushes.Black, Stretch = Stretch.Uniform } }; btnApply.Click += BtnApply_Click; stack.Children.Add(btnApply); } var btnShow = new Button() { Style = showBtn, DataContext = itm, Content = new System.Windows.Shapes.Path() { Data = show, Fill = Brushes.Black, Stretch = Stretch.Uniform } }; btnShow.Click += BtnShow_Click; stack.Children.Add(btnShow); var lIdx = map.LineIndexAt(itm.Start); var lIdx2 = map.LineIndexAt(itm.End); var header = lIdx == lIdx2?string.Format("line: {0}", lIdx + 1) : string.Format("lines: {0} - {1}", lIdx + 1, lIdx2 + 1); stack.Children.Add(new TextBlock() { Text = header, VerticalAlignment = VerticalAlignment.Center, Margin = stackMargin }); previews.Add(new Expander() { Header = stack, Content = previewData.Item1, IsExpanded = MainVM.Instance.ExpandedPreviews, Background = Brushes.LightYellow, Margin = expanderMargin }); } } if (!ct.IsCancellationRequested) { foreach (var p in previews) { ContentContainer.Children.Add(p); } } Helpers.mainCTX.Post(_ => NotifyPropertyChanged(nameof(Count)), null); }
public static Tuple <UIElement, Tuple <int, int, string> > MakePreview(PreviewMap map, IMapValueItem itm, int previwCount, string value) { var grid = new Grid() { VerticalAlignment = VerticalAlignment.Stretch }; Tuple <UIElement, Tuple <int, int, string> > res = new Tuple <UIElement, Tuple <int, int, string> >(grid, null); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid.ColumnDefinitions.Add(new ColumnDefinition() /*{ Width = GridLength.Auto }*/); var nums = new StackPanel(); Grid.SetColumn(nums, 0); var vals = new StackPanel(); Grid.SetColumn(vals, 1); grid.Children.Add(vals); /* * var sb = new ScrollViewer() { Content = vals, HorizontalScrollBarVisibility = ScrollBarVisibility.Auto, VerticalScrollBarVisibility = ScrollBarVisibility.Disabled }; * Grid.SetColumn(sb, 1); * grid.Children.Add(sb); * //*/ grid.Children.Add(nums); var changed = !string.IsNullOrWhiteSpace(value); var lIdx = map.LineIndexAt(itm.Start); var lIdx2 = map.LineIndexAt(itm.End); var lastLine = Math.Min(lIdx2 + previwCount, map.LineStart.Count - 1); for (var line = Math.Max(lIdx - previwCount, 0); line <= lastLine; line++) { var brush = (line >= lIdx && line <= lIdx2) ? Brushes.Green : Brushes.Black; AddLine(nums, vals, line + 1, map.LineAt(line), brush, brush); if (changed && line == lIdx2) { var rIdx = map.LineStart[lIdx]; var rLen = map.LineStart[lIdx2] + map.LineLength[lIdx2] - map.LineStart[lIdx]; //var str = map.Code.Substring(rIdx, rLen); //try //{ // var iIdx = itm.EditStart - map.LineStart[lIdx]; // var len = itm.EditEnd - itm.EditStart; // str = str.Remove(iIdx, len); // str = str.Insert(iIdx, value).Replace("\r\n", "\n"); // str = str.Replace("\r\n", "\n"); //} //catch //{ //} //string[] lines = str.Split('\n'); string[] lines = map.Code.Substring(rIdx, rLen). Remove(itm.EditStart - map.LineStart[lIdx], itm.EditEnd - itm.EditStart). Insert(itm.EditStart - map.LineStart[lIdx], value).Replace("\r\n", "\n").Split('\n'); if (lines.Length > 1) { var idx = lIdx; var tab = lines[0]; //ищем отступ for (int i = 0; i < tab.Length; i++) { if (!char.IsWhiteSpace(tab[i])) { //оригинальный отступ + 2а пробела tab = tab.Substring(0, i) + " "; break; } } //добавим отступы к строкам for (int i = 1; i < lines.Length; i++) { lines[i] = tab + lines[i]; } //выведем строки в предпросмотр foreach (var ln in lines) { AddLine(nums, vals, ++idx, ln, Brushes.Red, Brushes.Red); } } else if (lines.Length == 1) { AddLine(nums, vals, lIdx + 1, lines[0], Brushes.Red, Brushes.Red); } //данные для замены в файле, индекс начала, длина, и текст на замену res = new Tuple <UIElement, Tuple <int, int, string> >(res.Item1, new Tuple <int, int, string>(rIdx, rLen, string.Join("\r\n", lines))); } } return(res); }
public void PreviewMapConstructorTest() { PreviewMap target = new PreviewMap(); Assert.Inconclusive("TODO: Implement code to verify target"); }
private static Viewport DuplicateViewPort(PreviewMap preview, ViewSheet copiedSheet, ViewDrafting copiedView) { Viewport recipientViewport = null; Viewport sourceViewport = null; try { if (null != preview.SourceViewProperties.SheetObj) { sourceViewport = preview.SourceViewProperties.ViewportObj; if (null != sourceViewport) { using (Transaction trans = new Transaction(preview.RecipientModelInfo.Doc, "Place Viewports")) { try { trans.Start("Create Viewport"); XYZ viewportLocation = preview.SourceViewProperties.ViewLocation; string viewportTypeName = preview.SourceViewProperties.ViewportTypeName; recipientViewport = Viewport.Create(preview.RecipientModelInfo.Doc, copiedSheet.Id, copiedView.Id, viewportLocation); if (null != recipientViewport) { ElementId viewportTypeId = ElementId.InvalidElementId; List <ElementId> elementTypeIds = recipientViewport.GetValidTypes().ToList(); foreach (ElementId typeId in elementTypeIds) { ElementType eType = preview.RecipientModelInfo.Doc.GetElement(typeId) as ElementType; if (eType.Name == viewportTypeName) { viewportTypeId = typeId; break; } } if (viewportTypeId != ElementId.InvalidElementId) { ElementId typeId = recipientViewport.ChangeTypeId(viewportTypeId); } else { CopyPasteOptions options = new CopyPasteOptions(); options.SetDuplicateTypeNamesHandler(new HideAndAcceptDuplicateTypeNamesHandler()); List <ElementId> typeIds = new List <ElementId>(); typeIds.Add(sourceViewport.GetTypeId()); ICollection <ElementId> copiedTypeIds = ElementTransformUtils.CopyElements(preview.SourceModelInfo.Doc, typeIds, preview.RecipientModelInfo.Doc, Transform.Identity, options); if (copiedTypeIds.Count > 0) { viewportTypeId = copiedTypeIds.First(); ElementId typeId = recipientViewport.ChangeTypeId(viewportTypeId); } } FailureHandlingOptions failOpt = trans.GetFailureHandlingOptions(); failOpt.SetFailuresPreprocessor(new WarningMessagePreprocessor()); trans.Commit(failOpt); if (null != recipientViewport) { trans.Start("Wirte Parameter Values"); foreach (Parameter param in sourceViewport.Parameters) { if (!param.IsReadOnly) { #if RELEASE2014 Parameter rParam = recipientViewport.get_Parameter(param.Definition.Name); #elif RELEASE2015 || RELEASE2016 || RELEASE2017 Parameter rParam = recipientViewport.LookupParameter(param.Definition.Name); #endif if (null != rParam) { if (!rParam.IsReadOnly) { if (rParam.StorageType == param.StorageType) { switch (param.StorageType) { case StorageType.Double: rParam.Set(param.AsDouble()); break; case StorageType.Integer: rParam.Set(param.AsInteger()); break; case StorageType.String: rParam.Set(param.AsString()); break; } } } } } } FailureHandlingOptions failureOptions = trans.GetFailureHandlingOptions(); failureOptions.SetFailuresPreprocessor(new HideSameParameterValuePreprocessor()); trans.Commit(failureOptions); } } } catch (Exception ex) { MessageBox.Show("Failed to duplicate the viewport.\n" + ex.Message, "Duplicate Viewport", MessageBoxButton.OK, MessageBoxImage.Warning); trans.RollBack(); } } } } } catch (Exception ex) { errorMessage.AppendLine("Failed to duplicate viewports.\n" + ex.Message); //MessageBox.Show("Failed to find the viewport.\n"+ex.Message, "Find Source Viewport", MessageBoxButton.OK, MessageBoxImage.Warning); } return(recipientViewport); }
private static ViewSheet DuplicateSheet(PreviewMap previewMap) { ViewSheet viewSheet = null; try { Document toDoc = previewMap.RecipientModelInfo.Doc; //check existing viewsheets in recipient model FilteredElementCollector collector = new FilteredElementCollector(toDoc);; List <ViewSheet> viewsheets = collector.OfClass(typeof(ViewSheet)).WhereElementIsNotElementType().ToElements().Cast <ViewSheet>().ToList(); var sheets = from view in viewsheets where view.ViewName == previewMap.SourceViewProperties.SheetName && view.SheetNumber == previewMap.SourceViewProperties.SheetNumber select view; if (sheets.Count() > 0) { viewSheet = sheets.First(); } else //create sheet from source model { //ElementId titleBlockTypeId = GetTitleBlockId(previewMap); using (Transaction transaction = new Transaction(toDoc, "Create Sheet")) { transaction.Start(); try { FailureHandlingOptions failOpt = transaction.GetFailureHandlingOptions(); failOpt.SetFailuresPreprocessor(new WarningMessagePreprocessor()); transaction.SetFailureHandlingOptions(failOpt); viewSheet = ViewSheet.Create(toDoc, ElementId.InvalidElementId); transaction.Commit(); } catch (Exception ex) { string message = ex.Message; transaction.RollBack(); } } if (null != viewSheet) { using (Transaction trans = new Transaction(toDoc, "Copy Title Block")) { FilteredElementCollector vCollector = new FilteredElementCollector(previewMap.SourceModelInfo.Doc, previewMap.SourceViewProperties.SheetObj.Id); List <FamilyInstance> instances = vCollector.OfCategory(BuiltInCategory.OST_TitleBlocks).OfClass(typeof(FamilyInstance)).ToElements().Cast <FamilyInstance>().ToList(); if (instances.Count > 0) { List <ElementId> copiedIds = new List <ElementId>(); CopyPasteOptions options = new CopyPasteOptions(); options.SetDuplicateTypeNamesHandler(new HideAndAcceptDuplicateTypeNamesHandler()); foreach (FamilyInstance instance in instances) { try { trans.Start(); List <ElementId> titleBlock = new List <ElementId>(); titleBlock.Add(instance.Id); ICollection <ElementId> copiedId = ElementTransformUtils.CopyElements(previewMap.SourceViewProperties.SheetObj, titleBlock, viewSheet, Transform.Identity, options); copiedIds.AddRange(copiedId); FailureHandlingOptions failureOptions = trans.GetFailureHandlingOptions(); failureOptions.SetFailuresPreprocessor(new HidePasteDuplicateTypesPreprocessor()); trans.Commit(failureOptions); if (null != copiedId) { trans.Start(); LocationPoint slocation = instance.Location as LocationPoint; XYZ sourcePoint = slocation.Point; FamilyInstance copiedTitleBlock = toDoc.GetElement(copiedId.First()) as FamilyInstance; LocationPoint tlocation = copiedTitleBlock.Location as LocationPoint; XYZ targetPoint = tlocation.Point; XYZ moveVector = sourcePoint - targetPoint; ElementTransformUtils.MoveElement(toDoc, copiedTitleBlock.Id, moveVector); trans.Commit(failureOptions); } } catch (Exception ex) { string message = ex.Message; trans.RollBack(); } } } } using (Transaction transaction = new Transaction(toDoc, "Write Sheet Parameter")) { transaction.Start(); FailureHandlingOptions failOpt = transaction.GetFailureHandlingOptions(); failOpt.SetFailuresPreprocessor(new WarningMessagePreprocessor()); transaction.SetFailureHandlingOptions(failOpt); try { foreach (Parameter param in previewMap.SourceViewProperties.SheetObj.Parameters) { if (!param.IsReadOnly) { #if RELEASE2014 Parameter rParam = viewSheet.get_Parameter(param.Definition.Name); #elif RELEASE2015 || RELEASE2016 || RELEASE2017 Parameter rParam = viewSheet.LookupParameter(param.Definition.Name); #endif if (null != rParam) { if (rParam.StorageType == param.StorageType) { switch (param.StorageType) { case StorageType.Double: rParam.Set(param.AsDouble()); break; case StorageType.Integer: rParam.Set(param.AsInteger()); break; case StorageType.String: rParam.Set(param.AsString()); break; } } } } } transaction.Commit(); } catch (Exception ex) { string message = ex.Message; transaction.RollBack(); } } return(viewSheet); } } } catch (Exception ex) { errorMessage.AppendLine(previewMap.SourceViewProperties.SheetName + ": failed to create sheet.\n" + ex.Message); //MessageBox.Show(previewMap.SourceViewProperties.SheetName + " Failed to create sheet.\n" + ex.Message, "Duplicate Sheet", MessageBoxButton.OK, MessageBoxImage.Warning); } return(viewSheet); }
public static PreviewMap DuplicateView(PreviewMap previewMap, bool createSheet) { PreviewMap preview = previewMap; try { CopyPasteOptions options = new CopyPasteOptions(); options.SetDuplicateTypeNamesHandler(new HideAndAcceptDuplicateTypeNamesHandler()); Document toDoc = preview.RecipientModelInfo.Doc; List <ElementId> viewIds = new List <ElementId>(); using (TransactionGroup tg = new TransactionGroup(toDoc, "Duplicate across documents with detailing")) { tg.Start(); if (preview.IsEnabled) { ViewDrafting copiedView = null; if (null != preview.SourceViewProperties.LinkedView) //already exist in recipient model { ViewDrafting sourceView = previewMap.SourceViewProperties.ViewDraftingObj; ICollection <ElementId> referenceCalloutIds = sourceView.GetReferenceCallouts(); ElementId viewId = new ElementId(preview.SourceViewProperties.LinkedView.ViewId); using (Transaction trans = new Transaction(preview.RecipientModelInfo.Doc, "Delete Existing Contents")) { trans.Start(); try { FailureHandlingOptions failOpt = trans.GetFailureHandlingOptions(); failOpt.SetFailuresPreprocessor(new WarningMessagePreprocessor()); trans.SetFailureHandlingOptions(failOpt); FilteredElementCollector collector = new FilteredElementCollector(preview.RecipientModelInfo.Doc, viewId); collector.WherePasses(new ElementCategoryFilter(ElementId.InvalidElementId, true)); ICollection <ElementId> toDelete = collector.ToElementIds(); ICollection <ElementId> deletedIds = preview.RecipientModelInfo.Doc.Delete(toDelete); trans.Commit(); } catch (Exception ex) { string message = ex.Message; trans.RollBack(); } } copiedView = preview.RecipientModelInfo.Doc.GetElement(viewId) as ViewDrafting; if (null != copiedView) { int numOfCopied = DuplicateDetailingAcrossViews(preview.SourceViewProperties.ViewDraftingObj, copiedView); } if (referenceCalloutIds.Count > 0) { bool placedCallout = DuplicateReferenceCallouts(sourceView, copiedView); } if (createSheet) { //delete existing viewport ElementClassFilter filter = new ElementClassFilter(typeof(Viewport)); FilteredElementCollector collector = new FilteredElementCollector(preview.RecipientModelInfo.Doc); List <Viewport> viewports = collector.WherePasses(filter).Cast <Viewport>().ToList <Viewport>(); var query = from element in viewports where element.ViewId == viewId select element; if (query.Count() > 0) { Viewport viewport = query.First(); using (Transaction trans = new Transaction(preview.RecipientModelInfo.Doc, "Delete exisitng viewport")) { trans.Start(); try { FailureHandlingOptions failOpt = trans.GetFailureHandlingOptions(); failOpt.SetFailuresPreprocessor(new WarningMessagePreprocessor()); trans.SetFailureHandlingOptions(failOpt); preview.RecipientModelInfo.Doc.Delete(viewport.Id); trans.Commit(); } catch (Exception ex) { string message = ex.Message; trans.RollBack(); } } } if (preview.SourceViewProperties.IsOnSheet && null != preview.SourceViewProperties.SheetObj) { ViewSheet copiedSheet = DuplicateSheet(preview); if (null != copiedView && null != copiedSheet) { if (Viewport.CanAddViewToSheet(preview.RecipientModelInfo.Doc, copiedSheet.Id, copiedView.Id)) { Viewport recipientViewport = DuplicateViewPort(preview, copiedSheet, copiedView); } } } } } else { if (preview.SourceViewProperties.IsOnSheet && createSheet) { ViewSheet copiedSheet = DuplicateSheet(preview); copiedView = DuplicateDraftingViews(preview); if (null != copiedSheet && null != copiedView) { if (Viewport.CanAddViewToSheet(preview.RecipientModelInfo.Doc, copiedSheet.Id, copiedView.Id)) { Viewport viewport = DuplicateViewPort(preview, copiedSheet, copiedView); } } } else { copiedView = DuplicateDraftingViews(preview); } } preview = UpdatePreviewMap(preview, copiedView); } tg.Assimilate(); } } catch (Exception ex) { errorMessage.AppendLine(previewMap.SourceViewProperties.ViewName + ": errors in duplicating detailing across views\n" + ex.Message); //MessageBox.Show("Failed to duplicate drafiting views.\n" + ex.Message, "Duplicate Drafting Views", MessageBoxButton.OK, MessageBoxImage.Warning); } return(preview); }
private void UpdatePreviewMap() { previewMap = MapGenerator.GeneratePreviewMap(mapWidth, mapHeight, worldMinHeight, worldMaxHeight, previewSettings, heightMap, currentTextureSettings /*, new ClutterMap[] { rockClutterMap, treeClutterMap }*/); worldPreviewImage.texture = TextureGenerator.TextureFromFloatArray2D(previewMap.values, previewMap.colorValues, previewMap.colors); }