POST
|
I have working code that creates a new grouplayer and add some custom layers to it. However when I later create a new custom layer and add it to an existing grouplayer; it is not drawn and I have to right-click on the group layer and press refresh. I have code that I use to refresh the drawing which works for non group layers: void Util::refresh(IScenePtr scene, ILayerPtr layer)
{
ISceneGraphPtr sgraph;
scene->get_SceneGraph(&sgraph);
sgraph->Invalidate(layer, VARIANT_TRUE, VARIANT_TRUE);
ISceneViewerPtr viewer;
sgraph->get_ActiveViewer(&viewer);
sgraph->Invalidate(viewer, VARIANT_TRUE, VARIANT_TRUE);
sgraph->RefreshViewers();
} I have tried to call this with both the group layer and the new custom layer without any success.
... View more
03-13-2014
12:34 AM
|
0
|
0
|
1892
|
POST
|
How is a custom layer supposed to be destructed? I have a custom layer that implements drawing by overriding IActiveViewEvents::AfterDraw. The problem is that sometimes when the custom layer is removed from the Scene/Table Of Contents it is still drawn!? The FinalRelease() method is never called in my custom layer. 1. I would expect it to be ArcScenes responsibility to delete my custom layer when it is removed?; which in turn would call my FinalRelease() method. 2. If my custom layer is not in the Scene/Table Of Contents; how comes it receives IActiveViewEvents::AfterDraw calls? I would expect ArcScene to draw only layers in the Scene/Table Of Contents. Thanks in advance for any answers! Andreas
... View more
02-14-2014
02:30 AM
|
0
|
0
|
544
|
POST
|
ITopologicalOperator Call the Intersect method with esriGeometry0Dimension? Does this take care of the 2D part of the intersection or do I have to strip away any z information first by copying the x and y value of the points?
... View more
01-24-2014
05:20 AM
|
0
|
0
|
80
|
POST
|
I have one closed Polyline: "rectangle" and an open Polyline: "line". Both Polylines may be Z aware. What is the best way to find if the "line" intersects the "rectangle" in the XY plane? That is I want a 2D (XY) test for intersection. I do not need the actual coordinates of any intersection(s).
... View more
01-24-2014
05:04 AM
|
0
|
4
|
443
|
POST
|
I am developing for ArcScene using ArcObjects SDK in C++. Do any of you have the possibility to send code samples to ESRI directly and get answers? If so what kind of support plan/agreement does your company have with ESRI? Best regards, Andreas
... View more
01-05-2014
09:58 PM
|
0
|
0
|
252
|
POST
|
I am using IGeneralMultiPatchCreator to create a textured MultiPatch. This works fine for small texture images, but fails for larger images (15 MB .png). In ArcScene the MultiPatch is displayed in grey, the same way it would be if the "Disable material textures" checkbox on the Rendering tab of the Layer Properties was checked. I have tried to increase the max texture memory for the layer: I3DProperties2Ptr prop3D = layer;
long maxTextureMemory = 128*1024*1024;
prop3D->put_MaxTextureMemory(maxTextureMemory);
prop3D->Apply3DProperties(layer); but this does not seem to have any effect :-(. I have also tried to split the MultiPatch into parts where each part have a smaller texture image, but this does not seem to work either.
... View more
12-13-2013
05:17 AM
|
0
|
0
|
545
|
POST
|
I have a custom Toolbar. To this I want to add a Menu, MyMenu, with some items. I have implemented IMultiItem to return the items:
class CMyItems :
...
public IMultiItem
...
STDMETHOD(OnPopup)(LPDISPATCH Hook, long * ItemCount)
{
m_ipApp = Hook;
*ItemCount = 2;
return S_OK;
}
STDMETHOD(get_ItemCaption)(long index, BSTR * itemName)
{
if(index == 0)
*itemName = ::SysAllocString(L"MyItem1");
else if(index == 1)
*itemName = ::SysAllocString(L"MyItem2");
return S_OK;
};
I have a the following menu class:
class CMyMenu :
...
public ICommand,
public IMenuDef
...
STDMETHOD(get_ItemCount)(long * numItems)
{
*numItems = 1;
return S_OK;
}
STDMETHOD(GetItemInfo)(long pos, IItemDef * itemDef)
{
// CLSID of CMyItems:
itemDef->put_ID(L"{2B5842E2-B14C-463E-9733-5BFF271C9BEF}");
itemDef->put_SubType(1);
return S_OK;
}
};
I add this to my toolbar: STDMETHOD(GetItemInfo)(long pos, IItemDef * itemDef)
{
if (itemDef == NULL)
return E_POINTER;
if (pos == 0) {
itemDef->put_Group (VARIANT_FALSE);
// CLSID of CMyMenu
HRESULT hr = itemDef->put_ID(CComBSTR(L"{96A2B223-BF0D-410C-B22B-892FED3D9A15}"));
if (FAILED (hr)) {
return hr;
}
}
} When I start ArcScene; I see CMyMenu on my toolbar but it is empty!
... View more
11-08-2013
05:32 AM
|
0
|
1
|
429
|
POST
|
I have a custom command:
class ATL_NO_VTABLE CSliceSelector :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CSliceSelector, &CLSID_SliceSelector>,
public ISliceSelector,
public ICommand,
public IComboBox
{
...
}
I also have a custom Toolbar where I try to add my custom command:
class ATL_NO_VTABLE CSeismicToolbar :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CSeismicToolbar, &CLSID_SeismicToolbar>,
public ISeismicToolbar,
public IToolBarDef
{
...
STDMETHOD(GetItemInfo)(long pos, IItemDef * itemDef) {
if (itemDef == NULL)
return E_POINTER;
if (pos == 0) { // CSliceSelector
itemDef->put_Group (VARIANT_FALSE);
HRESULT hr = itemDef->put_ID(CComBSTR(L"{96A2B223-BF0D-410C-B22B-892FED3D9A15}"));
if (FAILED (hr)) {
return hr;
}
}
}
}
However when I start ArcScene; I see a red circle icon and the text "Missing" (see the attached image), instead of my command :-(. However if I add it manually from Customize toolbars; it works fine. I have tried both returning a null pointer and a valid bitmap:
CSliceSelector()
{
m_hBitmap = ::LoadBitmap(_AtlBaseModule.GetModuleInstance(),MAKEINTRESOURCE(IDB_SLICE));
}
STDMETHODIMP CSliceSelector::get_Bitmap(OLE_HANDLE * Bitmap)
{
if (Bitmap == NULL)
return E_POINTER;
*Bitmap = (OLE_HANDLE) m_hBitmap;
return S_OK;
}
I have other commands that are not combobox; and they work fine.
... View more
11-04-2013
04:56 AM
|
0
|
0
|
261
|
POST
|
I am having a lot of problems with the #import of ESRI C++ libraries. I am using precompiled headers: stdafx.h: #import <esriSystem.olb> raw_interfaces_only, raw_native_types, no_namespace, named_guids, auto_search , exclude("OLE_COLOR", "OLE_HANDLE", "VARTYPE") #import <esriSystemUI.olb> raw_interfaces_only, raw_native_types, no_namespace, named_guids, auto_search, exclude("IProgressDialog") // ... The import order seem to be very important. Thing may work fine and then I add a new class where I need to use a new ESRI library and BOOM, I get a lot of strange compilation errors. One common source of problems are interfaces that occur in both windows system libraries and ESRI libraries. For instance I might get a compilation error complaining about esriFramework::IPropertyPage not being defined. When I look trough the CC output I note that this was automatically excluded when importing the esriFramework.olb. Any advice on how to prevent such problems?
... View more
10-31-2013
04:26 AM
|
0
|
1
|
492
|
POST
|
I am experiencing some strange behaviour in my C++ code in ArcScene 10.1. I have selected one Feature of type Simple Polygon. The Feature has one field called "Name" of type text. I am trying to read the value of this field but just get an empty variant. Also if I ask the feature about its object id; it returns -1, although the feature class has an OBJECTID field. However if I start editing on the feature class with the 3D Editor, do nothing and save my code works!? Just activating the 3D Editor from Customize->Toolbars do not work. What is happening here? Here is my code: STDMETHODIMP CselectCubeCmd::OnClick() { std::wstring fileName = L""; CComBSTR fieldName(L"Name"); IDocumentPtr doc; m_ipApp->get_Document( &doc ); ISxDocumentPtr sxdoc; sxdoc = doc; IScenePtr scene; sxdoc->get_Scene( &scene ); esriCarto::ISelectionPtr selection; scene->get_FeatureSelection( &selection ); IEnumFeaturePtr features = selection; features->Reset(); IFeaturePtr feature; for(;;) { features->Next( &feature ); if(feature == NULL) break; long OID; feature->get_OID(&OID); // usually = -1 :-( IGeometryPtr shape; feature->get_Shape( &shape ); if( shape == NULL ) continue; esriGeometryType ftype; shape->get_GeometryType(&ftype); if(ftype == esriGeometryPolygon || ftype == esriGeometryPolyline) { IFieldsPtr fields; feature->get_Fields( &fields ); long Index; HRESULT res = fields->FindField( fieldName, &Index ); if( res == S_OK && Index > 0 ) { IFieldPtr field; fields->get_Field(Index, &field); if(field != NULL) { esriFieldType type; field->get_Type(&type); if(type == esriFieldTypeString ) { VARIANT var; HRESULT hr = feature->get_Value(Index, &var); if(var.vt == VT_EMPTY) { int stop = 1; // comes here usually :-( } else { CComBSTR target_name(var.bstrVal); // name found :-) turn_on_brick_layer(target_name); // do something } } } } } } return updateTOC(); } Thanks in advance for any answers! Andreas W. Paulsen
... View more
10-07-2013
08:29 AM
|
0
|
1
|
472
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|