+ m_metafiles[m_currentAngle].CalculateSize(this);
+}
+
+// Which metafile do we use now? Based on current rotation and validity
+// of metafiles.
+
+int wxDrawnShape::DetermineMetaFile(double rotation)
+{
+ double tolerance = 0.0001;
+ const double pi = 3.1415926535897932384626433832795 ;
+ double angle1 = 0.0;
+ double angle2 = pi/2.0;
+ double angle3 = pi;
+ double angle4 = 3.0*pi/2.0;
+
+ int whichMetafile = 0;
+
+ if (oglRoughlyEqual(rotation, angle1, tolerance))
+ {
+ whichMetafile = 0;
+ }
+ else if (oglRoughlyEqual(rotation, angle2, tolerance))
+ {
+ whichMetafile = 1;
+ }
+ else if (oglRoughlyEqual(rotation, angle3, tolerance))
+ {
+ whichMetafile = 2;
+ }
+ else if (oglRoughlyEqual(rotation, angle4, tolerance))
+ {
+ whichMetafile = 3;
+ }
+
+ if ((whichMetafile > 0) && !m_metafiles[whichMetafile].IsValid())
+ whichMetafile = 0;
+
+ return whichMetafile;
+}
+
+void wxDrawnShape::OnDrawOutline(wxDC& dc, double x, double y, double w, double h)
+{
+ if (m_metafiles[m_currentAngle].GetOutlineOp() != -1)
+ {
+ wxNode* node = m_metafiles[m_currentAngle].GetOps().Nth(m_metafiles[m_currentAngle].GetOutlineOp());
+ wxASSERT (node != NULL);
+ wxDrawOp* op = (wxDrawOp*) node->Data();
+
+ if (op->OnDrawOutline(dc, x, y, w, h, m_width, m_height))
+ return;
+ }
+
+ // Default... just use a rectangle
+ wxRectangleShape::OnDrawOutline(dc, x, y, w, h);
+}
+
+// Get the perimeter point using the special outline op, if there is one,
+// otherwise use default wxRectangleShape scheme
+bool wxDrawnShape::GetPerimeterPoint(double x1, double y1,
+ double x2, double y2,
+ double *x3, double *y3)
+{
+ if (m_metafiles[m_currentAngle].GetOutlineOp() != -1)
+ {
+ wxNode* node = m_metafiles[m_currentAngle].GetOps().Nth(m_metafiles[m_currentAngle].GetOutlineOp());
+ wxASSERT (node != NULL);
+ wxDrawOp* op = (wxDrawOp*) node->Data();
+
+ if (op->GetPerimeterPoint(x1, y1, x2, y2, x3, y3, GetX(), GetY(), GetAttachmentMode()))
+ return TRUE;
+ }
+
+ // Default... just use a rectangle
+ return wxRectangleShape::GetPerimeterPoint(x1, y1, x2, y2, x3, y3);