Community of MapPoint and Bing Maps Users and Developers
This is a discussion on C++ and passing Variant Arrays within the MapPoint Desktop Discussion forums, part of the Map Forums category; Mappoint has a number of methods that require ArrayOfFields: These Include: ImportData LinkData ImportTerritories LinkTerritories SetFieldsVisibleInBalloon My problem is I ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| C++ and passing Variant Arrays ImportData LinkData ImportTerritories LinkTerritories SetFieldsVisibleInBalloon My problem is I don't seem to be able to create the Variant array properly Has anyone had any experience with this problem? |
| ||||
|
Hi Garry, After our emails, I remembered a program I wrote that did work with fields. I've had a look at it, and it only queries the fields of existing pushpins. I don't use ArrayOfFields, but if you think it would help I could post it. (I use the getItem method on a Fields object) Could the polyline/polygon variant code be modified so that they pass "an array of Field" objects rather than "array of Location" objects? Richard
__________________ Winwaed Software Technology LLC http://www.winwaed.com See http://www.mapping-tools.com for MapPoint Tools See the Geoweb Guru for online mapping |
| |||
| C Builder and variants
I have managed to get SetFieldsVisibleInBalloon working using C++. Deriving some code from Richard Marsden proved to be the solution. FieldsPtr pFields = pDataSet->Fields; long i; int count = pFields->Count; FieldPtr pField; Variant index = 0; // CBuilder variant HRESULT hr; VARIANT v; SAFEARRAY FAR* psa; SAFEARRAYBOUND saBound; saBound.cElements = count; saBound.lLbound = 0; psa = SafeArrayCreate( VT_DISPATCH, 1, &saBound ); VariantInit( &v ); V_VT( &v ) = VT_ARRAY + VT_DISPATCH; V_ARRAY( &v ) = psa; for ( i = 0; i < count; i++ ) { index = i + 1; pField = pFields->get_Item( index ); hr = SafeArrayPutElement( psa, &i, pField ); } pDataSet->SetFieldsVisibleInBalloon( v ); |
| ||||
| Re: C++ and passing Variant Arrays
Here's my code below. See the second parameter, this is where I get hung up. It says it will default to the first valid field, so I put the column I want to map as the first field. How can I simply specify the default for the DataField parameter? Thanks, Eric Code: oDSPtr->DisplayDataMap(MapPoint::geoDataMapTypeMultipleSymbol, NULL, MapPoint::geoShowByDefault, MapPoint::geoCombineByNone, MapPoint::geoRangeTypeUniqueValues, MapPoint::geoRangeOrderDefault, MapPoint::geoColorSchemeDefault, 5); // [ArrayOfCustomValues], [ArrayOfCustomNames], [DivideByField], [ArrayOfDataFieldLabels], [ArrayOfPushpinSymbols]); |
| |||
| Re: C++ and passing Variant Arrays
Hi, perhaps it helps You: //from my program ..... Code: void CMapPage::ShowParkPoints()
{
try
{
if(m_bShowPark)
{
m_dsParkPoints = m_DataSets.ImportData(m_strParkPointsPath, NULL,
geoCountryDefault, geoDelimiterDefault, NULL);
m_dsParkPoints.SetSymbol(20);
int nRecordCount = m_dsParkPoints.GetRecordCount ();
if(nRecordCount == 0)
{
//AfxMessageBox (_T("There are no \"Park\" points"), MB_ICONINFORMATION);
return;
}
COleSafeArray saFields;
saFields.CreateOneDim (VT_DISPATCH, 4);
long lIndex[1];
CFields colFields = m_dsParkPoints.GetFields ();
CField objField;
for(int i = 0; i < 4; i ++)
{
lIndex[0] = i;
objField = colFields.GetItem(COleVariant((long) (i + 2)));
saFields.PutElement (lIndex, objField.m_lpDispatch);
}
m_dsParkPoints.SetFieldsVisibleInBalloon (saFields);
m_DataSets.ZoomTo ();
}
else
m_dsParkPoints.Delete();
} //try
catch (COleDispatchException * pExpn)
{
#ifdef _DEBUG
pExpn->ReportError ();
#endif
pExpn->Delete ();
}
}
|
| |||
| Re: C++ and passing Variant Arrays
Hi Dr. Nobody! I'm still having the same problems. Have you suceeded in adding the fieldlist to ImportData? Pit Quote:
|
![]() |
| Tags |
| arrays, passing, variant |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Passing a VARIANT for LinkData() method using VC++ | geouser | MapPoint Desktop Discussion | 1 | 07-15-2006 06:30 AM |
| How can i find address by passing Lat/Lon as parameter? | joesebi | MapPoint Desktop Discussion | 1 | 07-09-2003 09:10 AM |