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
Fang Yaqiong [EMAIL PROTECTED]
2007-06-27
Regards&Thanks!
Tel:010-5157-0010 Ext.6202
Beijing Redflag CH2000 Software Co., Ltd.