osman hömek / not defteri

July 25, 2008

form nesnelerine client erişimi

Filed under: dotnet — osman @ 4:52 pm

<asp:DropDownList ID=”ActiveLayerName” runat=”server”></asp:DropDownList> 

Böyle bir nesneniz var diyelimBu nesne ESRI nesnesi de olabilir 

    var activeLayerClientId = “<%=ActiveLayerName.ClientID%>”;    var objActiveLayerName = document.getElementById(activeLayerClientId); 

objActiveLayerName değişkeni ile varolan dropdown nesnesi object türünden elinizde oluyor.

July 24, 2008

transaction c# oracle

Filed under: oracle pl/sql, dotnet — osman @ 5:02 pm

static void runsql(string sql, OracleConnection dbconn){

OracleTransaction tran;tran = dbconn.BeginTransaction();

OracleCommand cmd = new OracleCommand();cmd.Connection = dbconn;

cmd.Transaction = tran;

try

{

cmd.CommandText = sql;

long rows = cmd.ExecuteNonQuery();tran.Commit();

Console.WriteLine(“islem tamamlandi {0}”, rows + ” satir guncellendi”);}

catch (Exception etc){

tran.Rollback();

Console.WriteLine(“islem tamamlanamadi”);Console.WriteLine(etc.Message.ToString());}

}

July 10, 2008

geodatabase üzerinden feature create yöntemi (point to multipoint)

Filed under: geodatabase, arcobjects — osman @ 1:50 pm

protected void Button2_Click(object sender, EventArgs e){

try

{

string kaynaktbl = txtSourceTableName.Text.ToString();string hedeftbl = txtTargetTableName.Text.ToString();//workspace connection

string server = txtServer.Text.ToString();string instance = txtInstance.Text.ToString();

string username = txtUsername.Text.ToString();string password = txtPassword.Text.ToString();

string database = txtDatabase.Text.ToString();string version = txtVersion.Text.ToString();

IWorkspace pWS = SDEWorkspaceFromPropertySet(server, instance, username, password, database, version);IWorkspaceEdit pWSEdit;pWSEdit = (

IWorkspaceEdit)pWS;pWSEdit.StartEditing(false);pWSEdit.StartEditOperation();

IFeatureWorkspace pFeatureWS;pFeatureWS = (

IFeatureWorkspace)pWS;IFeatureClass pFClass;

IFeatureClass pFClassMulti;pFClassMulti = pFeatureWS.OpenFeatureClass(hedeftbl);

pFClass = pFeatureWS.OpenFeatureClass(kaynaktbl);

ITable pfClassTable = (ITable)pFClass;int satirSayisi = pfClassTable.RowCount(null);System.Collections.Generic.

List<int> constructoidList = new System.Collections.Generic.List<int>();for (int k = 1; k <= satirSayisi; k++){

constructoidList.Add(k);

}

int[] oidList = constructoidList.ToArray();IFeatureCursor featureCursor = pFClass.GetFeatures(oidList, false);

IFeature feature = featureCursor.NextFeature();while (feature != null){

IFeature geom = feature;

IPoint pnt = (IPoint)geom.Shape;double xcoord = pnt.X;

double ycoord = pnt.Y;string pObjectId = geom.get_Value(0).ToString(); //objectid

string pKod = geom.get_Value(1).ToString(); //kod

string pAd = geom.get_Value(2).ToString(); //ad

string pTip = geom.get_Value(3).ToString(); //tip

//———

IPoint mpnt = new PointClass();mpnt.X = xcoord;

mpnt.Y = ycoord;

object missing = Type.Missing;Multipoint Multipnt = new Multipoint();Multipnt.AddPoint(mpnt,

ref missing, ref missing);IFeature pFeatMulti = pFClassMulti.CreateFeature();pFeatMulti.Shape = (

IGeometry)Multipnt;pFeatMulti.set_Value(1, pKod);

pFeatMulti.set_Value(2, pAd);

pFeatMulti.set_Value(3, pTip);

pFeatMulti.Store();

//———

feature = featureCursor.NextFeature();

}

pWSEdit.StopEditing(true); //KAYIT ETMEK İÇİN TRUE YAPILMASI GEREKLİ

pWSEdit.StopEditOperation();

Response.Write(“<font color=’green’><b>ISLEM TAMAM!</b></font><hr>”);/////////////////////////////////////////////////////////////////////////////////

}

catch (Exception etc){

Response.Write(“<font color=’red’><b>” + etc.Message.ToString() + “</b></font><hr>”);}

}

public ESRI.ArcGIS.Geodatabase.IWorkspace SDEWorkspaceFromPropertySet(String server, String instance, String user, String password, String database, String version){

ESRI.ArcGIS.esriSystem.IPropertySet propertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();propertySet.SetProperty(“SERVER”, server);propertySet.SetProperty(

“INSTANCE”, instance);propertySet.SetProperty(“DATABASE”, database);propertySet.SetProperty(

“USER”, user);propertySet.SetProperty(“PASSWORD”, password);propertySet.SetProperty(

“VERSION”, version);ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory;workspaceFactory = (ESRI.ArcGIS.Geodatabase.

IWorkspaceFactory2)new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();return workspaceFactory.Open(propertySet, 0);}

kullanılan referanslar

using ESRI.ArcGIS.Carto;

using ESRI.ArcGIS.Geometry;

using ESRI.ArcGIS.Geodatabase;

using ESRI.ArcGIS.DataSourcesGDB;

 Arama ! -> ESRI.ArcGIS.esriSystem için ESRI.ArcGIS.System i yüklenmeli!

Powered by WordPress