Plugin Cafe's original forum is still archived and available for searches. The ability to post here has been disabled.
 
Developer's Forum [PREV] [NEXT]
Subject: RE: NewPolygonObject
From: Mikael Sterner
Date: 12/13/2001 2:27 PM GMT
    You'll need a function like this to create a PolygonObject with polygons and points, before you can set the values:

    NewPolygonObject(pointCount, polygonCount)
    {
      if (pointCount < 0 || polygonCount < 0) return FALSE;
      
      var newObject = new(PolygonObject);
      
      var pointArray = new(array, pointCount);
      var polygonArray = new(array, polygonCount * 4);
    
      // Modify the arrays here if you want!
      
      newObject->SetPoints(pointArray);
      newObject->SetPolygons(polygonArray);
      
      var variableChanged = new(VariableChanged);
      var backupTags = new(BackupTags);
      
      backupTags->Init(newObject);
      variableChanged->Init(0, pointCount);
      if (!newObject->Message(MSG_POINTS_CHANGED, variableChanged))
      {
        backupTags->Restore();
        return FALSE;
      }
      
      backupTags->Init(newObject);
      variableChanged->Init(0, polygonCount);
      if (!newObject->Message(MSG_POLYGONS_CHANGED, variableChanged))
      {
        backupTags->Restore();
        return FALSE;
      }
      
      newObject->Message(MSG_UPDATE);
      return newObject;
    }
    

    Mikael Sterner
    Developer Support
Current Message String
new Add points to PolygonObject - Daniel Bindel - 12/12/2001 4:09 PM GMT
 new RE: NewPolygonObject - Mikael Sterner - 12/13/2001 2:27 PM GMT
[PREV] [NEXT]