Hi Fang,
this looks interesting. At this point it gets harder to see the big
picture from this short
code samples. You should start to create a child workspace and add your
changes
to the cvs, thats easier to keep track for me.
As for your question, you can use a map from stl with the id as key and
the B2DPoint as
a value.
Regards,
Christian
Fang Yaqiong wrote:
> Hi Christian,
>
>> Yes you must return the min point with the id, but it must be the min
>> point from the compared PolyPolygon, not the min point
>> from the PolyPolygon in the cache. And this must be added to the
>> translation of the shape that uses this PolyPolygon.
>>
>
> In order to get the id and the offset in the placeshape, I define a struct
> which contians the Id and the minPoint like this,
> struct IdMinPoint
> {
> sal_uInt16 nID;
> B2DPoint maMinPoint;
> };
> then I set a vector to store them.
>
> In Writer::defineShape(), before I return the nShapId, I set the id and the
> minPoint to the vector. The codes are like this:
> maIdMinPoint.nID = nShapeId;
> maIdMinPoint.maMinPoint = maMinPoint;
> maIdMinPointVector.push_back(maIdMinPoint);
> return nShapeId;
>
> In Writer::placeShape(), before mpTag->addMatrix( aMatrix ); I judge wether
> it is a complex charactor or not, if it is, then I translate the minPoint
> according to the vector first. The codes are like this:
> bool bIsIdMinPoint = false;
> std::vector<IdMinPoint>::const_iterator iter(maIdMinPointVector.begin());
> while (iter!=maIdMinPointVector.end())
> {
> IdMinPoint maIdMinPoint = *iter;
> if (maIdMinPoint.nID == nID)
> {
> aMatrix.translate(maIdMinPoint.maMinPoint.getX(),
> maIdMinPoint.maMinPoint.getY());
> mpTag->addMatrix( aMatrix ); // transformation matrix
> bIsIdMinPoint = true;
> }
> iter++;
> }
> if (!bIsIdMinPoint)
> {
> mpTag->addMatrix( aMatrix ); // transformation matrix
> }
>
> I find it works well in this part, but it is a little more complex to store
> the id and minPoint in a vector and then to compare every IdMinPoint. Can you
> give me any suggestions about this to make it easier?
>
> Best regards,
> Fang
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]