POST
|
Dear All, I've written the following code trying to copy the subtypes of a feature class, but got the following error message in the set_Domain method, could anyone help point out what's wrong? Error message: "This database does not support null default values." Program: private bool copySubTypes(IFeatureLayer pFeatureLayer, IFeatureClass fgdbFeatureClass, IWorkspace fgdbWorkspace) { if (pFeatureLayer == null || pFeatureLayer.FeatureClass == null) return true; ISubtypes subtypes = (ISubtypes)pFeatureLayer.FeatureClass; ISubtypes fgdbSubTypes = (ISubtypes)fgdbFeatureClass; IWorkspaceDomains fgdbWSdomain = (IWorkspaceDomains)fgdbWorkspace; if (!subtypes.HasSubtype) return true; fgdbSubTypes.SubtypeFieldName = subtypes.SubtypeFieldName; IEnumSubtype enumsubtype; int subtypeCode; string subtypeName; IFields pFields = pFeatureLayer.FeatureClass.Fields; enumsubtype = subtypes.Subtypes; enumsubtype.Reset(); subtypeName = enumsubtype.Next(out subtypeCode); while (subtypeName != null) { fgdbSubTypes.AddSubtype(subtypeCode, subtypeName); for (int iCnt = 0; iCnt < pFields.FieldCount; iCnt++) { string sFieldName = pFields.get_Field(iCnt).Name; object defVal = subtypes.get_DefaultValue(subtypeCode, sFieldName); if (defVal.ToString().Length > 0) { fgdbSubTypes.set_DefaultValue(subtypeCode, sFieldName, defVal); } IDomain pDomain = subtypes.get_Domain(subtypeCode, sFieldName); if (pDomain != null) { IDomain fgdbDomain = fgdbWSdomain.get_DomainByName(pDomain.Name); if (fgdbDomain == null) { return false; } else { fgdbSubTypes.set_Domain(subtypeCode, sFieldName, fgdbDomain); } } } subtypeName = enumsubtype.Next(out subtypeCode); } return true; } Bila
... View more
11-23-2012
04:52 PM
|
0
|
0
|
1885
|
POST
|
Dear All, I've written the following code trying to copy the subtypes of a feature class, but got the following error message in the set_Domain method, could anyone help point out what's wrong? Error message: "This database does not support null default values." Program: private bool copySubTypes(IFeatureLayer pFeatureLayer, IFeatureClass fgdbFeatureClass, IWorkspace fgdbWorkspace) { if (pFeatureLayer == null || pFeatureLayer.FeatureClass == null) return true; ISubtypes subtypes = (ISubtypes)pFeatureLayer.FeatureClass; ISubtypes fgdbSubTypes = (ISubtypes)fgdbFeatureClass; IWorkspaceDomains fgdbWSdomain = (IWorkspaceDomains)fgdbWorkspace; if (!subtypes.HasSubtype) return true; fgdbSubTypes.SubtypeFieldName = subtypes.SubtypeFieldName; IEnumSubtype enumsubtype; int subtypeCode; string subtypeName; IFields pFields = pFeatureLayer.FeatureClass.Fields; enumsubtype = subtypes.Subtypes; enumsubtype.Reset(); subtypeName = enumsubtype.Next(out subtypeCode); while (subtypeName != null) { fgdbSubTypes.AddSubtype(subtypeCode, subtypeName); for (int iCnt = 0; iCnt < pFields.FieldCount; iCnt++) { string sFieldName = pFields.get_Field(iCnt).Name; object defVal = subtypes.get_DefaultValue(subtypeCode, sFieldName); if (defVal.ToString().Length > 0) { fgdbSubTypes.set_DefaultValue(subtypeCode, sFieldName, defVal); } IDomain pDomain = subtypes.get_Domain(subtypeCode, sFieldName); if (pDomain != null) { IDomain fgdbDomain = fgdbWSdomain.get_DomainByName(pDomain.Name); if (fgdbDomain == null) { return false; } else { fgdbSubTypes.set_Domain(subtypeCode, sFieldName, fgdbDomain); } } } subtypeName = enumsubtype.Next(out subtypeCode); } return true; } Bila
... View more
11-23-2012
07:00 AM
|
0
|
1
|
934
|
POST
|
Yes, there's a MarkerSymbol property inside the MarkerLineSymbol. By checking the symbol type of the MarkerSymbol using TypeOf, I'm able to check which type of marker symbol the MarkerLineSymbol is built on.
... View more
02-06-2012
06:31 AM
|
0
|
0
|
159
|
POST
|
I found there's a "Units" property in ISymbolPropertyPage. How could I link up a Symbol to it's SymbolPropertyPage and get this Units property value? Please point out if I'm in a wrong direction.
... View more
02-04-2012
04:26 AM
|
0
|
0
|
185
|
POST
|
By using TypeOf, I could tell a symbol is a Marker Line Symbol. Can I use the same trick (something as follow) to check whether this Marker Line Symbol is build up from which type of Marker Symbol? If TypeOf pSbl Is IMarkerLineSymbol Then MsgBox "It is a Marker Line Symbol" If TypeOf pSbl Is ICharacterMarkerSymbol Then MsgBox "It is a Character Marker Symbol" elseif TypeOf pSbl Is IPictureMarkerSymbol Then MsgBox "It is a Picture Marker Symbol" End if End If
... View more
02-03-2012
06:21 AM
|
0
|
2
|
472
|
POST
|
I can only find properties like "Width", "Color", "Outline Color", why the "Units" property is not found from ISymbol and it's co-classes? Where can I obtain the Units property using VBA?
... View more
02-03-2012
06:13 AM
|
0
|
1
|
544
|
POST
|
What's the difference between interface and co-class? When we use 'TypeOf', should we use 'TypeOf xxx Is' followed by an interface or followed by a co-class? I ask this because when I check a linesymbol against the interface of different linesymbols, I got no match; when I use co-class, I got all match.
... View more
01-24-2012
06:16 PM
|
0
|
0
|
260
|
POST
|
I did something like this, but why it didn't work? The program error out in the 'Set' statement. Dim Symbol As ISymbol = simpleRenderer.Symbol Dim MLSymbol As IMarkerLineSymbol Dim SLSymbol As ISimpleLineSymbol If TypeOf Symbol Is IMarkerLineSymbol Then Set MLSymbol = Symbol ElseIf TypeOf Symbol Is ISimpleLineSymbol Then Set SLSymbol = Symbol End If
... View more
01-24-2012
05:08 AM
|
0
|
0
|
260
|
POST
|
I am writing a VBA program to extract symbol properties under feature layers of a MxDocument. I'm able to extract properties like symbol colors and line width, but when I try to get more detail, I'm not able to tell whether a symbol is SimpleLineSymbol or MarkerLineSymbol. My program is like this: Dim pGFL As IGeoFeatureLayer Dim pSbl As ISymbol Dim pSPR As ISimplyRenderer Dim pMLS As IMarkerLineSymbol If TypeOf pGFL.Renderer Is ISimpleRenderer Then Set pSPR = pGFL.Renderer If pFL.FeatureClass.ShapeType = esriGeometryPolyline Then Set pMLS = pSbl MsgBox "Marker Symbol Size = " & pMLS.MarkerSymbol.Size End If End If But I got error when I came over Set pMLS = pSbl. If I define pMLS as MarkerLineSymbol instead of IMarkerLineSymbol, the statement Set pMLS = pSbl works, but then it'll say pMLS.MarkerSymbol is a undefined method. If I declare pMLS as ILineSymbol, I can set pMLS = pSbl, but I'm not able to get the MarkerSymbol related properties. Could anyone share with me: (1) How to obtain the Marker Symbol related properties from a ISymbol? (2) How to determine the type of Symbol, e.g., SimpleLineSymbol or MarkerLineSymbol? Thanks.
... View more
01-24-2012
03:44 AM
|
0
|
4
|
1988
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|