How to update the data display range when the spatial data range changes

Source: Internet
Author: User

When data editing or dirty data occurs, the display of spatial data may fail to display the complete display of the full graph, in this case, you need to update the data range to correctly display the full graph data range. You need to update the data range by code. The core code is as follows:

C # engine:

Ischemalock schemalock = (ischemalock) temp. featureclass;
Try
{
Ifeatureclassmanage featureclassmanage = (ifeatureclassmanage) temp. featureclass;
Featureclassmanage. updateextent ();
Schemalock. changeschemalock (esrischemalock. esrisharedschemalock );
}
Catch (exception E)
{
Schemalock. changeschemalock (esrischemalock. esrisharedschemalock );
}

VBA:

Public sub updatefcextent ()
Dim PAPP as igxapplication
Dim pgxobj as igxobject
Dim pgxdataset as igxdataset
Set PAPP = Application
Set pgxobj = Papp. selectedobject
Set pgxdataset = pgxobj

Dim PFC as ifeatureclass
Set PFC = pgxdataset. Dataset

Dim pfeatureclassmanage as ifeatureclassmanage
Set pfeatureclassmanage = PFC

Pfeatureclassmanage. updateextent
End sub

[Visual Basic 6.0]:

Public sub recalcext ()
Dim pgxapplication as igxapplication
Set pgxapplication = Application

Dim pgxobject as igxobject
Set pgxobject = pgxapplication. selectedobject

If not typeof pgxobject. internalobjectname is ifeatureclassname then
Exit sub
End if

Dim pname as INAME
Set pname = pgxobject. internalobjectname
Dim pschemalock as ischemalock
Set pschemalock = pname. Open

Pschemalock. changeschemalock esriexclusiveschemalock
Dim pfeatureclassmanage as ifeatureclassmanage
Set pfeatureclassmanage = pschemalock
Pfeatureclassmanage. updateextent

Exit sub

Errhandler:
Pschemalock. changeschemalock esrisharedschemalock
End sub

Python:

# Coding: cp936
Import _ winreg
Import comtypes
From comtypes. Client import getmodule
From comtypes. Client import Createobject
# Find the installation path of ArcGIS 10. My 64-bit system has wow6432node. If it is a 32-bit system, remove the node.
Keyesri = _ winreg. openkey (_ winreg. HKEY_LOCAL_MACHINE, "software // wow6432node // ESRI // shorttop10.0 ")
Arcgispath = _ winreg. queryvalueex (keyesri, "installdir") [0] + "com //"
# Load necessary Libraries
Getmodule (arcgispath + 'esrisponcesfile. olb ')
Getmodule (arcgispath + 'esrigeodatabase. olb ')
Getmodule (arcgispath + 'esrisystem. olb ')
Getmodule (comtypes. GUID ("{6fccede0-179d-4d12-b586-58c88d26ca78}"), 1, 0) # esriversion
Import comtypes. gen. esrisponcesfile as esrisponcesfile
Import comtypes. gen. esrigeodatabase as esrigeodatabase
Import comtypes. gen. esrisystem as esrisystem
Import comtypes. gen. arcgisversionlib as esriversion
# For ArcGIS 10.0 and later versions, bind the version first. 9.x does not use the following two statements:
Versionmanager = Createobject (esriversion. versionmanager, interface = esriversion. iarcgisversion)
Versionmanager. loadversion (esriversion. esriarcgisdesktop, "10.0 ")
# Initialize AO, which is the same as that in C ++
Aoinit = Createobject (esrisystem. aoinitialize, interface = esrisystem. iaoinitialize)
Pcode = esrisystem. esrilicenseproductcodearcinfo
Status = aoinit. isproductcodeavailable (pcode)
If status = esrisystem. esrilicenseavailable:
Aoinit. initialize (pcode)
Shpfilewsfactory = Createobject (esridatasourcesfile. shapefileworkspacefactory, interface = esrigeodatabase. iworkspacefactory)
Shpfilews = shpfilewsfactory. openfromfile (r 'd:/temp/P/testtooldata ', 0). QueryInterface (esrigeodatabase. ifeatureworkspace)
Featureclass = shpfilews. openfeatureclass ("test1 ")
Featuremanger = featureclass. QueryInterface (esrigeodatabase. ifeatureclassmanage)
Featuremanger. updateextent ()
Del featuremanger
Del featureclass

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.