|
@@ -10,15 +10,15 @@ bool isDPCurve(IVGShapePtr s) {
|
|
|
return dpc;
|
|
|
}
|
|
|
IVGShapePtr CreateBoundary(corel *cdr, IVGShapePtr s) {
|
|
|
-
|
|
|
- auto scp = s->CreateBoundary(0, 0, true, false);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ IVGShapePtr scp;
|
|
|
+ if (cdr->VersionMajor < 17) {
|
|
|
+ s->CreateSelection();
|
|
|
+ cdr->FrameWork->Automation->InvokeItem( _bstr_t("b0491566-5ffe-450a-b17e-f2f496b4eb22"));
|
|
|
+ scp = cdr->ActiveSelectionRange->Shapes->Item[1];
|
|
|
+ } else {
|
|
|
+
|
|
|
+ scp = s->CreateBoundary(0, 0, true, false);
|
|
|
+ }
|
|
|
return scp;
|
|
|
}
|
|
|
|
|
@@ -103,17 +103,23 @@ bool BoundaryGroup(corel *cdr, IVGShapeRange *sr, IVGShapeRange *srs) {
|
|
|
|
|
|
|
|
|
|
|
|
- auto bounds = sr->CreateBoundary(0, 0, true, false);
|
|
|
- bounds->Fill->UniformColor->RGBAssign(255, 0, 0);
|
|
|
+ IVGShapePtr bounds;
|
|
|
+ if (cdr->VersionMajor < 17) {
|
|
|
+ sr->CreateSelection();
|
|
|
+ cdr->FrameWork->Automation->InvokeItem( _bstr_t("b0491566-5ffe-450a-b17e-f2f496b4eb22"));
|
|
|
+ bounds = cdr->ActiveSelectionRange->Shapes->Item[1];
|
|
|
+ bounds->OrderToFront();
|
|
|
+ } else {
|
|
|
+ bounds = sr->CreateBoundary(0, 0, true, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ bounds->Fill->UniformColor->RGBAssign(255, 0, 0);
|
|
|
auto sbox = bounds->BreakApartEx();
|
|
|
|
|
|
if (sbox->Count > 2) {
|
|
|
|
|
|
|
|
|
- sbox->Sort(
|
|
|
- _bstr_t(
|
|
|
- "@shape1.width * @shape1.height > @shape2.width * @shape2.height"),
|
|
|
- 1, sbox->Count, _variant_t());
|
|
|
+ sbox->Sort(bstr_t( "@shape1.width * @shape1.height > @shape2.width * @shape2.height"), 1, sbox->Count, _variant_t());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -161,10 +167,8 @@ bool BoundaryGroup(corel *cdr, IVGShapeRange *sr, IVGShapeRange *srs) {
|
|
|
|
|
|
void run_BoundaryGroup(corel *cdr) {
|
|
|
auto start = std::chrono::high_resolution_clock::now();
|
|
|
- if (cdr->VersionMajor < 17) {
|
|
|
- sprintf(infobuf, "异形群组目前只支持X7以上版本!");
|
|
|
- return;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
BeginOpt(cdr);
|
|
|
|
|
@@ -178,7 +182,7 @@ void run_BoundaryGroup(corel *cdr) {
|
|
|
cdr->ActiveDocument->ClearSelection();
|
|
|
|
|
|
if (cnt > 300) {
|
|
|
-
|
|
|
+
|
|
|
if (BoxGrouping(cdr, sr, sr_box, 0.1)) {
|
|
|
for (int i = 0; i < sr_box->Count; i++) {
|
|
|
auto s = sr_box->Shapes->Item[i + 1];
|