Skip navigation
Amit Birla
Currently Being Moderated

Getting Unknown shape for any Polygon

Feb 16, 2012 6:18 AM

Hi, i have come up with a strange Indesign behaviour.

Iam working on InDesign CS4.Iam using IsSplineShape(const UIDRef& itemUIDRef, PMString& shape) const function for getting the type of shape of the polygon, placed on the page of a document.

 

code snippet of this function is as follows:

 

///////////////////////////////////

bool16 SUIPanelObserver::IsSplineShape(const UIDRef& itemUIDRef, PMString& shape) const

{

    bool16 result = kFalse;

    InterfacePtr<IPathGeometry> pathGeometry(itemUIDRef,UseDefaultIID());

    if (pathGeometry != nil)

    {

        result = kTrue;

        PMPageItemType pathType = Utils<IPathUtils>()->WhichKindOfPageItem(pathGeometry);

        switch (pathType)

        {

        case kIsLine:

            shape = "Line";

            break;

        case kIsRectangle:

            shape = "Rectangle";

            break;

        case kIsCircle:

            shape = "Circle";

            break;

        case kIsOval:

            shape = "Oval";

            break;

        case kIsRegularPoly:

            shape = "RegularPoly";

            break;

        case kIsIrregularPoly:

            shape = "IrregularPoly";

            break;

        case kIsSquare:

            shape = "Square";

            break;

        default:

            shape = "Unknown";

            break;

        }

    }

    return result;

}

//////////////////////////////////

 

 

The problem is that, inspite of returning shape of a polygon as RegularPoly or IrregularPoly, it is actually returning  Unknown shape.

 

Also,i have tried both functions:

                                   Utils<IPathUtils>()->IsIrregularPolygon(pathGeometry);

                                   Utils<IPathUtils>()->IsRegularPolygon(pathGeometry);

 

In each case it returns me kFalse, means,the shape in neither a RegularPolygon nor a IrregularPolygon.

Is that because of multiple closed path in the shape? because any polygon is drawn under a bound box and hence we will not get single closed path.

 

Any Idea??

 
Replies
  • Currently Being Moderated
    Feb 16, 2012 3:12 PM   in reply to Amit Birla

    Are your test objects always combined paths? It might be very simple: two paths in one object is neither "a regular polygon" nor "an irregular polygon", because there are *two* shapes in that object. Looking at the list of available tests, neither one of them mentions the object can have more than a single path.

     

    Try it on singular path objects and see if it works correct.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points