public static void GenerateBlockImages(Document doc, MSCDataset dataset)
 {
     try
     {
         ToolPalette.InitializePaletteFolders();
         Database database = doc.Database;
         using (doc.LockDocument())
         {
             using (Transaction transaction = database.TransactionManager.StartTransaction())
             {
                 foreach (MSCFeatureService current in dataset.FeatureServices.Values)
                 {
                     if (!current.QueryOnly && current.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePoint)
                     {
                         ObjectId blockDefinition = DocUtil.GetBlockDefinition(doc, current.LayerName);
                         if (!(blockDefinition == ObjectId.Null))
                         {
                             ToolPalette.CreateBlockImage(transaction, doc, ToolPalette.ImageFolder, blockDefinition);
                         }
                     }
                 }
                 transaction.Commit();
             }
         }
     }
     catch
     {
     }
 }
        protected bool RequestUpdate(Extent viewExtent, bool forceRefresh)
        {
            if (!this.ParentServiceConnected)
            {
                return(false);
            }
            Extent extent = Extent.Intersect(viewExtent, this.BoundaryExtent);

            if (!extent.IsValid())
            {
                return(false);
            }
            if (string.IsNullOrEmpty(extent.SpatialReference))
            {
                extent.SpatialReference = this.BoundaryExtent.SpatialReference;
            }
            if (!forceRefresh && this.CurrentExtent != null && this.CurrentExtent.Equals(extent))
            {
                return(false);
            }
            if (!this.ParentDataset.ParentDocument.Editor.IsQuiescent && DocUtil.GetDimensionalInputEnabled())
            {
                return(false);
            }
            this.RequestNewRaster(extent);
            this.OutstandingRequestInfo = viewExtent;
            return(true);
        }
Example #3
0
 private void createPDFFile()
 {
     foreach (DocumentTreeView documentTreeView in this.documentTreeViews)
     {
         if (documentTreeView.Leaf)
         {
             try
             {
                 this.appendDocument(documentTreeView.NodeName + ".docx");
             }
             catch (Exception)
             {
             }
         }
     }
     //Set the required export options:
     DevExpress.XtraPrinting.PdfExportOptions options = new DevExpress.XtraPrinting.PdfExportOptions();
     //options.DocumentOptions.Author = "Mark Jones";
     //options.Compressed = false;
     options.ImageQuality = DevExpress.XtraPrinting.PdfJpegImageQuality.High;
     //Export the document to the file:
     this.richEditControl1.ExportToPdf(this.doc_template_id + ".pdf", options);
     DocUtil.fileCopy(this.doc_template_id, this.wpd_file_name, "pdf");
     //Export the document to the file stream:
     using (FileStream pdfFileStream = new FileStream(this.wpd_file_name + ".pdf", FileMode.Create))
     {
         this.richEditControl1.ExportToPdf(pdfFileStream, options);
     }
 }
        public Extent(Document doc)
        {
            Point3d point3d;
            Point3d point3d2;

            if (DocUtil.GetActiveExtents(doc, out point3d, out point3d2))
            {
                Point3d point3d3 = new Point3d(point3d.X, point3d.Y, 0.0);
                Point3d point3d4 = new Point3d(point3d2.X, point3d2.Y, 0.0);
                this.XMin = new double?(point3d3.X);
                this.YMin = new double?(point3d3.Y);
                this.XMax = new double?(point3d4.X);
                this.YMax = new double?(point3d4.Y);
                try
                {
                    this.SpatialReference = AfaDocData.ActiveDocData.DocPRJ.WKT;
                    return;
                }
                catch
                {
                    try
                    {
                        this.SpatialReference = MSCPrj.ReadWKT(doc);
                    }
                    catch
                    {
                        this.SpatialReference = "";
                    }
                    return;
                }
            }
            this.XMin             = (this.XMax = (this.YMin = (this.YMax = new double?(0.0))));
            this.SpatialReference = "";
        }
 public void SetTransparency(int newValue)
 {
     try
     {
         this.CheckForUpdates();
         DocUtil.EnableTransparency();
         Document     parentDocument = this.ParentDataset.ParentDocument;
         byte         b            = Convert.ToByte(Math.Floor((100.0 - (double)newValue) / 100.0 * 254.0));
         Transparency transparency = new Transparency(b);
         using (parentDocument.LockDocument())
         {
             parentDocument.TransactionManager.EnableGraphicsFlush(true);
             var transactionManager = parentDocument.TransactionManager;
             using (Transaction transaction = transactionManager.StartTransaction())
             {
                 BlockTable       blockTable  = (BlockTable)transaction.GetObject(parentDocument.Database.BlockTableId, 0);
                 BlockTableRecord arg_A1_0    = (BlockTableRecord)transaction.GetObject(blockTable[(BlockTableRecord.ModelSpace)], (OpenMode)1);
                 RasterImage      rasterImage = (RasterImage)transaction.GetObject(this.RasterObjectId, (OpenMode)1);
                 rasterImage.Transparency = (transparency);
                 rasterImage.Draw();
                 parentDocument.TransactionManager.QueueForGraphicsFlush();
                 parentDocument.TransactionManager.FlushGraphics();
                 parentDocument.Editor.UpdateScreen();
                 transaction.Commit();
             }
         }
     }
     catch
     {
     }
 }
        public bool UpdateExtentFromCurrentView()
        {
            Editor arg_10_0 = this.ParentDataset.ParentDocument.Editor;
            Extent ext;

            return(DocUtil.GetActiveViewportExtents(this.ParentDataset.ParentDocument, out ext) && this.UpdateExtentLimit(ext));
        }
        public void ToggleVisiblity()
        {
            bool flag = DocUtil.GetEntityVisibility(this.ParentDataset.ParentDocument, this.RasterObjectId);

            flag = !flag;
            DocUtil.SetEntityVisibility(this.ParentDataset.ParentDocument, this.RasterObjectId, flag);
        }
Example #8
0
        public ViewInfo(Document doc, ObjectId rasterObjectId)
        {
            Extent extentFromObject = DocUtil.GetExtentFromObject(doc, rasterObjectId);

            this.Width       = extentFromObject.XMax.Value - extentFromObject.XMin.Value;
            this.Height      = extentFromObject.YMax.Value - extentFromObject.YMin.Value;
            this.CenterPoint = new Point2d(extentFromObject.XMin.Value + this.Width / 2.0, extentFromObject.YMin.Value + this.Height / 2.0);
        }
Example #9
0
 /// <summary>
 /// 上传文档
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (DocUtil.fileCopy(Convert.ToString(this.treeList1.FocusedNode.GetValue("NodeName"))))
     {
         this.richEditControl1.LoadDocument(
             Convert.ToString(this.treeList1.FocusedNode.GetValue("NodeName")) + ".docx"
             );
     }
 }
Example #10
0
 public FieldDomain(string name, CadField.CadFieldType fieldType, string domainType)
 {
     this.DisplayName = name;
     this.Name        = DocUtil.FixSymbolName(name);
     this.FieldType   = fieldType;
     this.DomainType  = domainType;
     this.CodedValues = new ObservableDictionary <string, MSCCodedValue>();
     this.FauxNull    = null;
     this.MinValue    = 0;
     this.MaxValue    = 0;
 }
        public static List <Entity> ToEntity(Geometry obj, Geometry denseObj, double defaultElevation, ObjectId blockDefId)
        {
            List <Entity> list = null;
            List <Entity> result;

            try
            {
                if (obj == null)
                {
                    result = null;
                }
                else
                {
                    PolygonN    polygonN    = obj as PolygonN;
                    PolylineN   polylineN   = obj as PolylineN;
                    PointN      pointN      = obj as PointN;
                    MultipointN multipointN = obj as MultipointN;
                    if (polygonN != null)
                    {
                        list = GIS2CAD.ToEntity(polygonN, denseObj as PolygonN, defaultElevation);
                    }
                    else if (polylineN != null)
                    {
                        list = GIS2CAD.ToEntity(polylineN, denseObj as PolylineN, defaultElevation);
                    }
                    else if (pointN != null)
                    {
                        list = GIS2CAD.ToEntity(pointN, defaultElevation, blockDefId);
                    }
                    else if (multipointN != null)
                    {
                        list = GIS2CAD.ToEntity(multipointN, defaultElevation);
                    }
                    else
                    {
                        DocUtil.ShowDebugMessage(AfaStrings.EncounteredUnknownObjectType);
                    }
                    if (list == null)
                    {
                        result = list;
                    }
                    else
                    {
                        result = list;
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
Example #12
0
        public void ReadMapLayer(Transaction t, ObjectId lyrDictionaryID)
        {
            DBDictionary dBDictionary = (DBDictionary)t.GetObject(lyrDictionaryID, 0);

            this.ID            = (int)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)90, "ID");
            this.ParentLayerID = (int)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)90, "ParentID");
            this.Visible       = false;
            if (dBDictionary.Contains("MapLayerName"))
            {
                Xrecord      xrecord = (Xrecord)t.GetObject(dBDictionary.GetAt("MapLayerName"), 0);
                TypedValue[] array   = xrecord.Data.AsArray();
                for (int i = 0; i < array.Length; i++)
                {
                    TypedValue typedValue = array[i];
                    if (typedValue.TypeCode == 1)
                    {
                        this.Name = typedValue.Value.ToString();
                        break;
                    }
                }
            }
            if (dBDictionary.Contains("Visible"))
            {
                Xrecord      xrecord2 = (Xrecord)t.GetObject(dBDictionary.GetAt("Visible"), 0);
                TypedValue[] array2   = xrecord2.Data.AsArray();
                for (int j = 0; j < array2.Length; j++)
                {
                    TypedValue typedValue2 = array2[j];
                    if (typedValue2.TypeCode == 290)
                    {
                        this.Visible = (0 != Convert.ToInt16(typedValue2.Value));
                        break;
                    }
                }
            }
            this.Layers = new List <MSCMapLayer>();
            if (dBDictionary.Contains("ChildLayers"))
            {
                DBDictionary dBDictionary2 = (DBDictionary)t.GetObject(dBDictionary.GetAt("ChildLayers"), 0);
                using (DbDictionaryEnumerator enumerator = dBDictionary2.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        DBDictionaryEntry current = enumerator.Current;
                        MSCMapLayer       item    = new MSCMapLayer(t, current.Key, current.Value);
                        this.Layers.Add(item);
                    }
                }
            }
        }
        public bool GetVisibility()
        {
            bool result;

            try
            {
                result = DocUtil.GetEntityVisibility(this.ParentDataset.ParentDocument, this.RasterObjectId);
            }
            catch
            {
                result = true;
            }
            return(result);
        }
Example #14
0
        private void btnPreview_Click(object sender, RoutedEventArgs e)
        {
            Document              document              = AfaDocData.ActiveDocData.Document;
            Editor                editor                = document.Editor;
            ResultBuffer          resultBuffer          = this.BuildSelectionFilter();
            SelectionFilter       selectionFilter       = new SelectionFilter(resultBuffer.AsArray());
            PromptSelectionResult promptSelectionResult = editor.SelectAll(selectionFilter);

            if (promptSelectionResult.Status == (PromptStatus)5100 && promptSelectionResult.Value.Count > 0)
            {
                ObjectId[] objectIds = promptSelectionResult.Value.GetObjectIds();
                editor.WriteMessage(string.Format("\n{0} entities found", objectIds.Length));
                editor.SetImpliedSelection(DocUtil.ExpandGroupObjectIds(document, objectIds));
            }
        }
Example #15
0
 private void cbBoundingBoxTypes_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         this.IgnoreTextBoxChange = true;
         if (e.AddedItems.Count > 0)
         {
             string arg_23_0 = this.cbBoundingBoxTypes.Text;
             string text     = e.AddedItems[0].ToString();
             if (text == AfaStrings.DrawingExtents)
             {
                 Extent dwgExtent = DocUtil.GetDwgExtent(AfaDocData.ActiveDocData.Document);
                 this.ExtentOptions[text] = dwgExtent;
             }
             if (text == AfaStrings.CurrentView)
             {
                 Extent viewExtent = DocUtil.GetViewExtent(AfaDocData.ActiveDocData.Document);
                 this.ExtentOptions[text] = viewExtent;
             }
             if (text == AfaStrings.SelectCorners)
             {
                 this.cbBoundingBoxTypes.Refresh();
                 Window window = Window.GetWindow(this);
                 window.Visibility = Visibility.Collapsed;
                 Extent extentsFromCorners = DocUtil.GetExtentsFromCorners(AfaDocData.ActiveDocData.Document);
                 window.Visibility = Visibility.Visible;
                 if (!DocUtil.IsValidExtent(extentsFromCorners))
                 {
                     ComboBox comboBox = (ComboBox)sender;
                     comboBox.SelectedItem    = e.RemovedItems[0];
                     this.IgnoreTextBoxChange = false;
                     return;
                 }
                 this.ctrlBoundingBoxExtent.Content    = extentsFromCorners;
                 this.ExtentOptions[AfaStrings.Custom] = (this.CustomExtent = extentsFromCorners);
                 text = (this.cbBoundingBoxTypes.Text = AfaStrings.Custom);
             }
             if (text != AfaStrings.Custom)
             {
                 this.ctrlBoundingBoxExtent.Content = Utility.CloneObject(this.ExtentOptions[text]);
             }
         }
         this.IgnoreTextBoxChange = false;
     }
     catch
     {
     }
 }
Example #16
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value is string)
     {
         int num = 0;
         if (DocUtil.StringToDXFCode((string)value, ref num))
         {
             return(value);
         }
     }
     if (value is int)
     {
         return(DocUtil.DXFCodeToString((int)value));
     }
     return(MSCFeatureClass.GetTypeCodeString(MSCFeatureClass.fcTypeCode.fcTypePoint));
 }
        public void ZoomExtents()
        {
            this.CheckForUpdates();
            string a = MSCPrj.ReadWKT(this.ParentDataset.ParentDocument);

            if (a != this.BoundaryExtent.SpatialReference)
            {
                ErrorReport.ShowErrorMessage(AfaStrings.CoordinateSystemsDontMatch);
                return;
            }
            Point3d minPoint = new Point3d(this.BoundaryExtent.XMin.Value, this.BoundaryExtent.YMin.Value, 0.0);
            Point3d maxPoint = new Point3d(this.BoundaryExtent.XMax.Value, this.BoundaryExtent.YMax.Value, 0.0);

            DocUtil.ZoomExtents(minPoint, maxPoint);
            this.CheckForUpdates();
        }
Example #18
0
        protected DBDictionary WriteImageDictionary(DBDictionary parentDict, Transaction t)
        {
            DBDictionary result;

            try
            {
                parentDict.UpgradeOpen();
                DBDictionary dBDictionary = new DBDictionary();
                this.AcadDictionaryID = parentDict.SetAt(base.Name, dBDictionary);
                dBDictionary.DisableUndoRecording(true);
                t.AddNewlyCreatedDBObject(dBDictionary, true);
                DocUtil.WriteXRecord(t, dBDictionary, "AutoCADID", (DxfCode)330, base.RasterObjectId);
                DocUtil.WriteXRecord(t, dBDictionary, "ServiceFullName", (DxfCode)1, this.ServiceFullName);
                DocUtil.WriteXRecord(t, dBDictionary, "ConnectionName", (DxfCode)1, base.ConnectionName);
                DocUtil.WriteXRecord(t, dBDictionary, "ConnectionURL", (DxfCode)1, base.ConnectionURL);
                DocUtil.WriteXRecord(t, dBDictionary, "UserName", (DxfCode)1, base.UserName);
                if (base.Dynamic)
                {
                    Xrecord xrecord = new Xrecord();
                    xrecord.Data = (new ResultBuffer(new TypedValue[]
                    {
                        new TypedValue(290, true)
                    }));
                    dBDictionary.SetAt("Dynamic", xrecord);
                    xrecord.DisableUndoRecording(true);
                    t.AddNewlyCreatedDBObject(xrecord, true);
                }
                DocUtil.WriteBoundingBox(t, dBDictionary, base.BoundaryExtent);
                DocUtil.WriteXRecord(t, dBDictionary, "ImageFormat", (DxfCode)1, base.ExportOptions.Format);
                DocUtil.WriteXRecord(t, dBDictionary, "Compression", (DxfCode)1, base.ExportOptions.TransCompression);
                DocUtil.WriteXRecord(t, dBDictionary, "Quality", (DxfCode)90, base.ExportOptions.Quality);
                DocUtil.WriteXRecord(t, dBDictionary, "Interpolation", (DxfCode)1, base.ExportOptions.Interpolation);
                DocUtil.WriteXRecord(t, dBDictionary, "MosaicMethod", (DxfCode)1, base.ExportOptions.MosaicMethod);
                DocUtil.WriteXRecord(t, dBDictionary, "OrderField", (DxfCode)1, base.ExportOptions.OrderField);
                DocUtil.WriteXRecord(t, dBDictionary, "OrderBaseValue", (DxfCode)1, base.ExportOptions.OrderBaseValue);
                DocUtil.WriteXRecord(t, dBDictionary, "LockRasterID", (DxfCode)1, base.ExportOptions.LockRasterID);
                DocUtil.WriteXRecord(t, dBDictionary, "Ascending", (DxfCode)290, base.ExportOptions.Ascending);
                DocUtil.WriteXRecord(t, dBDictionary, "MosaicOperator", (DxfCode)1, base.ExportOptions.MosaicOperator);
                result = dBDictionary;
            }
            catch (Exception ex)
            {
                string arg_209_0 = ex.Message;
                result = null;
            }
            return(result);
        }
 private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (DocUtil.fileCopy(Convert.ToString(this.treeList1.FocusedNode.GetValue("Doc_catalog_id"))))
     {
         this.richEditControl1.LoadDocument(
             Convert.ToString(this.treeList1.FocusedNode.GetValue("Doc_catalog_id")) + ".docx"
             );
     }
     //  TODO    上传文件
     DocService.saveDocFile(
         new DocFileDTO(
             this.sprint_id
             , Convert.ToString(this.treeList1.FocusedNode.GetValue("Doc_catalog_id"))
             , Convert.ToString(this.treeList1.FocusedNode.GetValue("Doc_catalog_id")) + ".docx"
             )
         );
 }
Example #20
0
        public DBDictionary WriteMapLayer(DBDictionary parentDict, Transaction t)
        {
            DBDictionary dBDictionary = new DBDictionary();

            try
            {
                parentDict.SetAt(this.FixName(this.Name), dBDictionary);
                dBDictionary.DisableUndoRecording(true);
                t.AddNewlyCreatedDBObject(dBDictionary, true);
                DocUtil.WriteXRecord(t, dBDictionary, "MapLayerName", (DxfCode)1, this.Name);
                DocUtil.WriteXRecord(t, dBDictionary, "ID", (DxfCode)90, this.ID);
                DocUtil.WriteXRecord(t, dBDictionary, "ParentID", (DxfCode)90, this.ParentLayerID);
                if (this.Visible)
                {
                    Xrecord xrecord = new Xrecord();
                    xrecord.Data = (new ResultBuffer(new TypedValue[]
                    {
                        new TypedValue(290, true)
                    }));
                    dBDictionary.SetAt("Visible", xrecord);
                    xrecord.DisableUndoRecording(true);
                    t.AddNewlyCreatedDBObject(xrecord, true);
                }
            }
            catch
            {
            }
            try
            {
                if (this.Layers != null && this.Layers.Count > 0)
                {
                    DBDictionary dBDictionary2 = new DBDictionary();
                    dBDictionary.SetAt("ChildLayers", dBDictionary2);
                    t.AddNewlyCreatedDBObject(dBDictionary2, true);
                    foreach (MSCMapLayer current in this.Layers)
                    {
                        current.WriteMapLayer(dBDictionary2, t);
                    }
                }
            }
            catch
            {
            }
            return(dBDictionary);
        }
        protected void UpdateExistingRaster(object sender, ExportedImageEventArgs e)
        {
            if (this.PendingImage != null)
            {
                return;
            }
            this.PendingImage = e;
            new Extent(e.Points);
            Point3d  point3d  = new Point3d(this.PendingImage.Points[0].X, this.PendingImage.Points[0].Y, 0.0);
            Point3d  point3d2 = new Point3d(this.PendingImage.Points[1].X, this.PendingImage.Points[1].Y, 0.0);
            Point3d  point3d3 = new Point3d(this.PendingImage.Points[2].X, this.PendingImage.Points[2].Y, 0.0);
            Vector3d v        = point3d2 - point3d;
            Vector3d v2       = point3d3 - point3d;

            DocUtil.UpdateRasterImage(this.ParentDataset.ParentDocument, this.RasterObjectId, this.PendingImage.ExportOptions.OutputFile, point3d, v, v2);
            this.CurrentFileName = this.PendingImage.ExportOptions.OutputFile;
            this.PendingImage    = null;
        }
        public bool UpdateRasterNow()
        {
            bool result;

            try
            {
                bool flag = DocUtil.UpdateRasterImage(this._doc, this._rasterID, this.ImageURL, this.BasePoint, this.V1, this.V2);
                if (flag)
                {
                    this.lblReadyForUpdate.Text = "not ready";
                }
                result = flag;
            }
            catch (SystemException ex)
            {
                ErrorReport.ShowErrorMessage("Catch in UpdateRasterNow: " + ex.Message);
                result = false;
            }
            return(result);
        }
 public static void GenerateBlockIcons(Document doc, MSCDataset dataset)
 {
     try
     {
         Database        database = doc.Database;
         List <ObjectId> list     = new List <ObjectId>();
         using (doc.LockDocument())
         {
             using (Transaction transaction = database.TransactionManager.StartTransaction())
             {
                 foreach (MSCFeatureService current in dataset.FeatureServices.Values)
                 {
                     if (!current.QueryOnly && current.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePoint)
                     {
                         ObjectId blockDefinition = DocUtil.GetBlockDefinition(doc, current.LayerName);
                         if (!(blockDefinition == ObjectId.Null))
                         {
                             list.Add(blockDefinition);
                             foreach (MSCFeatureClassSubType current2 in current.SubTypes)
                             {
                                 ObjectId blockDefinition2 = DocUtil.GetBlockDefinition(doc, current2.CadLayerName);
                                 if (!(blockDefinition2 == ObjectId.Null))
                                 {
                                     list.Add(blockDefinition2);
                                 }
                             }
                         }
                     }
                 }
                 if (list.Count > 0)
                 {
                     ToolPalette.CreateBlockIcons(transaction, doc, list.ToArray());
                 }
                 transaction.Commit();
             }
         }
     }
     catch
     {
     }
 }
 private void AddImageService(object sender, ExportedImageEventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(e.ErrorMessage))
         {
             ErrorReport.ShowErrorMessage(e.ErrorMessage);
         }
         else if (e.Points != null && !string.IsNullOrEmpty(e.ExportOptions.OutputFile))
         {
             Point3d  point3d  = new Point3d(e.Points[0].X, e.Points[0].Y, 0.0);
             Point3d  point3d2 = new Point3d(e.Points[1].X, e.Points[1].Y, 0.0);
             Point3d  point3d3 = new Point3d(e.Points[2].X, e.Points[2].Y, 0.0);
             Point3d  p        = new Point3d(e.Points[1].X, e.Points[2].Y, 0.0);
             Vector3d v        = point3d2 - point3d;
             Vector3d v2       = point3d3 - point3d;
             ObjectId objectId = DocUtil.DefineRasterImage(AfaDocData.ActiveDocData.Document, e.ExportOptions.OutputFile, point3d, v, v2, "ESRI_" + e.MapName, e.ExportOptions.Transparency);
             if (!objectId.IsNull)
             {
                 DocUtil.SetEntityDisableUndo(AfaDocData.ActiveDocData.Document, objectId, true);
                 e.ExportOptions.BoundingBox = new Extent(point3d, p);
                 e.ExportOptions.BoundingBox.SpatialReference = e.ExportOptions.OutputWKT;
                 MSCImageService mSCImageService = MSCDataset.AddImageService((AGSImageService)e.MapService, objectId, e.ExportOptions);
                 if (mSCImageService != null)
                 {
                     DocUtil.AttachHyperlink(AfaDocData.ActiveDocData.Document, objectId, mSCImageService.Name, mSCImageService.RestEndpoint);
                     mSCImageService.UpdateToCurrentView();
                     mSCImageService.CheckForUpdates();
                 }
             }
         }
     }
     catch
     {
         if (string.IsNullOrEmpty(base.ErrorMessage))
         {
             base.ErrorMessage = AfaStrings.ErrorGeneratingImage;
         }
         throw;
     }
 }
        private void UpdateFromClass(Identify.IdentifyFeatureClassItem newItem)
        {
            Document document = AfaDocData.ActiveDocData.Document;

            using (document.LockDocument())
            {
                FCTag           tag = newItem.Tag;
                MSCFeatureClass activeFeatureClass = AfaDocData.ActiveDocData.SetActiveFeatureClass(tag.GetFeatureClass(AfaDocData.ActiveDocData.DocDataset));
                ArcGISRibbon.SetActiveFeatureClass(activeFeatureClass);
                ObjectId[] iDs    = newItem.IDs;
                Editor     editor = AfaDocData.ActiveDocData.Document.Editor;
                document.Editor.SetImpliedSelection(DocUtil.ExpandGroupObjectIds(AfaDocData.ActiveDocData.Document, iDs));
                ObjectIdCollection objectIds = null;
                if (iDs != null)
                {
                    objectIds = new ObjectIdCollection(iDs);
                }
                this.SetObjectIds(objectIds);
                editor.Regen();
            }
        }
Example #26
0
        private void BuildDocExtentOptions()
        {
            Document document = AfaDocData.ActiveDocData.Document;

            this.DocExtentOptions = new Dictionary <string, Extent>();
            this.DefaultExtent    = new Extent(0.0, 0.0, 100.0, 100.0);
            this.DefaultExtent.SetWKTFrom(AfaDocData.ActiveDocData.DocPRJ.WKT);
            if (DocUtil.HasLimits(AfaDocData.ActiveDocData.Document))
            {
                this.DocExtentOptions.Add(AfaStrings.DrawingLimits, DocUtil.GetLimitExtent(document));
            }
            Extent dwgExtent = DocUtil.GetDwgExtent(document);

            if (dwgExtent != null)
            {
                this.DocExtentOptions.Add(AfaStrings.DrawingExtents, DocUtil.GetDwgExtent(document));
            }
            Extent viewExtent = DocUtil.GetViewExtent(document);

            this.DocExtentOptions.Add(AfaStrings.CurrentView, viewExtent);
            this.DocExtentOptions.Add(AfaStrings.SelectCorners, this.DefaultExtent);
        }
 private void zoomToEntities()
 {
     try
     {
         Document document = AfaDocData.ActiveDocData.Document;
         Application.UseWaitCursor = true;
         document.Editor.SetImpliedSelection(DocUtil.ExpandGroupObjectIds(document, SelectByAttributesForm.oidsList.ToArray()));
         Utils.ZoomObjects(false);
         Application.UseWaitCursor = false;
         document.TransactionManager.QueueForGraphicsFlush();
         document.TransactionManager.FlushGraphics();
         document.Editor.UpdateScreen();
         AfaDocData.ActiveDocData.DocDataset.UpdateMaps();
     }
     catch (Exception ex)
     {
         if (SingletonsList.ed != null)
         {
             SingletonsList.ed.WriteMessage("\n" + AfaStrings.Error + " " + ex.Message);
         }
     }
 }
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            int num = 0;

            try
            {
                if (((string)value).Length > 0 && !DocUtil.StringToDXFCode((string)value, ref num))
                {
                    num = int.Parse((string)value);
                }
            }
            catch (SystemException ex)
            {
                ValidationResult result = new ValidationResult(false, AfaStrings.IllegalCharactersOr + ex.Message);
                return(result);
            }
            if (num < this.Min || num > this.Max)
            {
                return(new ValidationResult(false, AfaStrings.InvalidDXFCode));
            }
            return(new ValidationResult(true, null));
        }
        public bool CreateExportImage(string outputFileName)
        {
            bool result;

            try
            {
                this.StopReactors();
                if (!File.Exists(this.CurrentFileName))
                {
                    this.RequestNewRasterNow(this.DrawnViewInfo);
                }
                File.Copy(this.CurrentFileName, outputFileName, true);
                DocUtil.UpdateRasterImage(this.ParentDataset.ParentDocument, this.RasterObjectId, outputFileName);
                this.RasterObjectId = ObjectId.Null;
                if (base.GetType() == typeof(MSCMapService))
                {
                    AfaDocData.ActiveDocData.DocDataset.MapServices.Remove(this.Name);
                    MSCMapService mSCMapService = (MSCMapService)this;
                    mSCMapService.RemoveDictionary();
                    this.ParentDataset.MapServices.Remove(this.Name);
                    MSCDataset.SetDefaultActiveRasterServices();
                }
                if (base.GetType() == typeof(MSCImageService))
                {
                    AfaDocData.ActiveDocData.DocDataset.ImageServices.Remove(this.Name);
                    MSCImageService mSCImageService = (MSCImageService)this;
                    mSCImageService.RemoveDictionary();
                    this.ParentDataset.ImageServices.Remove(this.Name);
                    MSCDataset.SetDefaultActiveRasterServices();
                }
                result = true;
            }
            catch (SystemException)
            {
                result = false;
            }
            return(result);
        }
        protected DBDictionary WriteMapDictionary(DBDictionary parentDict, Transaction t)
        {
            DBDictionary result;

            try
            {
                parentDict.UpgradeOpen();
                DBDictionary dBDictionary = new DBDictionary();
                this.AcadDictionaryID = parentDict.SetAt(base.Name, dBDictionary);
                dBDictionary.DisableUndoRecording(true);
                t.AddNewlyCreatedDBObject(dBDictionary, true);
                DocUtil.WriteXRecord(t, dBDictionary, "AutoCADID", (DxfCode)330, base.RasterObjectId);
                DocUtil.WriteXRecord(t, dBDictionary, "ServiceFullName", (DxfCode)1, this.ServiceFullName);
                DocUtil.WriteXRecord(t, dBDictionary, "ConnectionName", (DxfCode)1, base.ConnectionName);
                DocUtil.WriteXRecord(t, dBDictionary, "ConnectionURL", (DxfCode)1, base.ConnectionURL);
                DocUtil.WriteXRecord(t, dBDictionary, "UserName", (DxfCode)1, base.UserName);
                if (base.Dynamic)
                {
                    Xrecord xrecord = new Xrecord();
                    xrecord.Data = (new ResultBuffer(new TypedValue[]
                    {
                        new TypedValue(290, true)
                    }));
                    dBDictionary.SetAt("Dynamic", xrecord);
                    xrecord.DisableUndoRecording(true);
                    t.AddNewlyCreatedDBObject(xrecord, true);
                }
                DocUtil.WriteBoundingBox(t, dBDictionary, base.BoundaryExtent);
                DocUtil.WriteXRecord(t, dBDictionary, "ImageFormat", (DxfCode)1, base.ExportOptions.Format);
                result = dBDictionary;
            }
            catch (Exception ex)
            {
                string arg_122_0 = ex.Message;
                result = null;
            }
            return(result);
        }