언어 설정

Menu
Sites
Language
issues with Polyline on HMAPs

Hello all, I'm trying to draw a polyline on a map using the HERE add-on SDK. I'm pretty much just following instructions but once I try to create a polyline the map wont even display. I have taken bits and pieces from the sample (as there it seems to work fine) to isolate the problem but no luck. Here is the code that displays the map

result PolylineTestMainForm::OnInitializing(void) {
    result r = E_SUCCESS;

	String appId = L"XXX";
	String appCode = L"XXX";

	if (!MapApplicationContext::GetInstance().IsInitialized())
		MapApplicationContext::GetInstance().Initialize(appCode, appId,
				LANGUAGE_ENG);

	Map*__pMap = new (std::nothrow) Map();
	r = __pMap->Construct(GetClientAreaBounds().width,
			GetClientAreaBounds().height);

	AddControl(__pMap);

	Coordinates coord;
	//Coordinates for Los Angeles
	coord.Set(34.0535, -118.245, 0.0);

	__pMap->SetCenter(coord);
	__pMap->SetZoomLevel(12.0);

	__pMap->AddMapEventListener(*this);
    SetFormBackEventListener(this);

    return r;
}

This displays the map ok. Now when I add the polyline code

    .
    .
    .

    Polyline* pPolyline = new (std::nothrow) Polyline();

	ArrayList polylineList(NoOpDeleter);
	polylineList.Construct();
	Coordinates c1;
	Coordinates c2;
	Coordinates c3;
	Coordinates c4;
	c1.Set(34.170896, -118.231267, 0);
	c2.Set(34.142485, -118.231267, 0);
	c3.Set(34.142485, -118.162603, 0);
	c4.Set(34.114066, -118.162603, 0);

	polylineList.Add(c1);
	polylineList.Add(c2);
	polylineList.Add(c3);
	polylineList.Add(c4);

	pPolyline->SetPath(polylineList);
	pPolyline->SetVisible(true);
	pPolyline->SetStrokeColor(Color::GetColor(COLOR_ID_RED));
	pPolyline->SetStrokeThickness(10);

	pPolyline->AddMapObjectEventListener(*this);

	__pMap->AddMapObject(pPolyline);

    SetFormBackEventListener(this);

    .
    .

I just get a blank map with the HERE logo. What am I doing wrong? This appears to be the exactly same think that is done in the sample. Thanks for any info in advance. Regards Jirka

답변 바로가기

Responses

1 댓글
Mark as answer
Jirka Prazak

I have found a solution after investigating futher.  In order for this to work one must call

__pMap->SetDisplayRegion(pPolyline->GetBoundingBox())

or

__pMap->SetCenter(coords);

I suggest you add this to the documentation as this is omitted and the code mentioned there simply wont work as is.

 

-Jirka