Page 1 of 1

Show attributes of a polyline (from dbf of SHP file)

Posted: Thu Aug 01, 2019 8:15 am
by miaowang
Hello,
When I select a polyline of a SHP file by mouse clicking, Properties Tree shows the properties of the polyline.
Is it possible to view attributes (from the corresponding Dbf file) alone with the polyline at Properties Tree or cc2DLable?
BTW, it seems that the dbf file is opened after loading shp file but not been closed.

Re: Show attributes of a polyline (from dbf of SHP file)

Posted: Fri Aug 02, 2019 8:33 am
by daniel
Indeed the file was not closed (that's fixed). Thanks for the feedback.

For the attributes, one would have to load them as scalar fields... But that's not done this way currently (just as 'z' coordinate if chosen by the user)

Re: Show attributes of a polyline (from dbf of SHP file)

Posted: Tue Aug 06, 2019 7:09 am
by miaowang
Hello Daniel,
Thank you for the reply.

Re: Show attributes of a polyline (from dbf of SHP file)

Posted: Thu Aug 08, 2019 2:34 am
by miaowang
Hi Daniel,
I am trying to implement this function. First, a class named ccShpDbf is declared. ccShpDbf contains a member variable
vector < GenericDBFField* > m_Fields;
to store attributes loaded from a DBF file. Thd DBF file is loaded after loading SHP entities at ShpFilter.cpp. The attributes of a SHP entity can be retrieved via its index.
BUT, where should a ccShpDbf be stored. I have tried to add ccShpDbf to a SHP container (ccHObject) using addDependency(). It is obviously a bad idea. Could you give me a hint for this?
I know that all SHP entities are currently direct children of a container. I don't want to change this hierarchy because it will lead to more change of the other codes, e.g., Mouse Click.