Add layers through SDE in AE)

Source: Internet
Author: User
Tags informix

 

Public void addsdelayer (bool chksdelinkmodle)
{
// <

SPAN style = "color: #008000;"> define an attribute
<

;/Span> ipropertyset propset = new propertysetclass ();
If (chksdelinkmodle = true) // connect with SDE
{
// Set the database server name
Propset. setproperty ("server", "ZJ-PC ");
// Set the SDE port, which is specified during installation. The default value is "port: 5151"
Propset. setproperty ("instance", "port: 5151 ");
// SDE Username
Propset. setproperty ("user", "SDE ");
// Password
Propset. setproperty ("password", "SDE ");
/// Set the database name. Only the SQL Server INFORMIX database needs to be set
// Propset. setproperty ("Database", "SDE ");
// SDE version, which is the default version
Propset. setproperty ("version", "SDE. Default ");
}
Else // direct connection
{
// Set the database server name. If it is a local machine, you can use "SDE: sqlserver :."
Propset. setproperty ("instance", "orcl ");
// SDE Username
Propset. setproperty ("user", "SDE ");
// Password
Propset. setproperty ("password", "SDE ");
// Set the database name. Only the SQL Server INFORMIX database needs to be set // propset. setproperty ("Database", "SDE ");
// SDE version, which is the default version
Propset. setproperty ("version", "SDE. Default ");
}
Iworkspacefactory fact = new sdeworkspacefactoryclass ();
Ifeatureworkspace workspace = (ifeatureworkspace) Fact. Open (propset, 0 );
Ifeatureclass FCLS = workspace. openfeatureclass ("SDE. historytrackline ");
Ifeaturelayer fly = new featurelayerclass ();
Fly. featureclass = FCLS;
Ifeatureclass fcls1 = workspace. openfeatureclass ("SDE. Province ");
Ifeaturelayer fly1 = new featurelayerclass ();
Fly1.featureclass = fcls1;

M_mapcontrol.map.addlayer (fly1 );
M_mapcontrol.map.addlayer (FLY );

M_mapcontrol.activeview.refresh ();
}

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.