#ifndef CNS_RESTRICTED_ZONE_H #define CNS_RESTRICTED_ZONE_H #include "cns.h" #ifdef __cplusplus extern "C" { #endif typedef struct CNS_RestrictedZoneConstraint * CNS_RestrictedZoneConstraintPtr ; /** * Creates a zone restriction constraint. * * This constraint can force a given set of parts to be nested inside restricted zones on the sheet * and not anywhere on the whole sheet. * * Note: You should define a limited number of restricted zones. In particular, you should not * define a restricted zone per part, but for instance create a zone in the center where to nest * small parts inside. */ CNS_EXPORT CNS_RestrictedZoneConstraintPtr CNS_API CNS_CreateRestrictedZoneConstraint(CNS_LaunchingOrderPtr order); /** * Define a zone in the sheet where parts can be nested according to the constraint. * * Note: Calling the function several times on the same sheet will allow all the defined zones. * * Note: You should define a restricted zone for all the sheets, otherwise the sheet with no * restricted zone defined will have an empty restricted zone, and parts attached to this restricted * zone through CNS_SetZoneRestrictedPart will not be nested on those sheets. */ CNS_EXPORT void CNS_API CNS_SheetAddRestrictedZone(CNS_RestrictedZoneConstraintPtr constraint, CNS_SheetPtr sheet, unsigned number_of_elements, const CNS_Element * elements); /** * Same as CNS_SheetAddRestrictedZone with simplified API for rectangular zones. */ CNS_EXPORT void CNS_API CNS_SheetAddBoxRestrictedZone(CNS_RestrictedZoneConstraintPtr constraint, CNS_SheetPtr sheet, CNS_Point bottom_left, CNS_Point top_right); /** * Set restriction constraint on the part. * * This part will be restricted to specific sheet zones that were added using * CNS_SheetAddRestrictedZone. * * Note: If a part is assigned to multiple restricted zones constraints, it will be nested in the * intersection of the restricted zones. */ CNS_EXPORT void CNS_API CNS_SetZoneRestrictedPart(CNS_RestrictedZoneConstraintPtr constraint, CNS_PartPtr part); /** * Specific function to force part to be nested on the bottom of the sheet. */ CNS_EXPORT void CNS_API CNS_ForcePartOnBottomBorder(CNS_PartPtr part); #ifdef __cplusplus } #endif #endif