void FlashMyImporter::Import(FlashTagDefineShape3 &data) { std::cout << "\n<FlashTagDefineShape3>\n"; std::cout << "ID:" << data.GetID() << "\n"; PrintRect(data.GetShapes().GetBounds()); PrintRect(data.rimport); }
/* RTreeSearch in an index tree or subtree for all data retangles that ** overlap the argument rectangle. ** Returns the number of qualifying data rects. */ LeafList_t *RTreeSearch(RTree_t * rtp, Node_t * n, Rect_t * r) { register int i; LeafList_t *llp = 0; assert(n); assert(n->level >= 0); assert(r); rtp->SeTouchCount++; if (n->level > 0) { /* this is an internal node in the tree */ for (i = 0; i < NODECARD; i++) if (n->branch[i].child && Overlap(r, &n->branch[i].rect)) { LeafList_t *tlp = RTreeSearch(rtp, n->branch[i].child, r); if (llp) { LeafList_t *xlp = llp; while (xlp->next) xlp = xlp->next; xlp->next = tlp; } else llp = tlp; } } else { /* this is a leaf node */ for (i = 0; i < NODECARD; i++) { if (n->branch[i].child && Overlap(r, &n->branch[i].rect)) { llp = RTreeLeafListAdd(llp, (Leaf_t *) & n->branch[i]); # ifdef RTDEBUG PrintRect(&n->branch[i].rect); # endif } } } return llp; }
//Main Function-------------------------------------------------------------------------------- int main() { srand(time (NULL)); struct Rectangle RandomRect[MAX_RECTS]; Rectangle r; int NumBoxes,TempNum; printf(" How many boxes you want? (max 25): "); scanf("%i",&NumBoxes); for (int i=0; i < MAX_RECTS; i++) { if (i<NumBoxes) { RandomRect[i] = GenRect(); } else { RandomRect[i] = 0; } } while (true){ printf("%i",NumBoxes); PrintRect(RandomRect, NumBoxes); switch (menu()) { case '1': printf("\n\nEnter The Rectangle Number You'd Like To Write To: "); scanf("%i",&TempNum); if (TempNum>NumBoxes) { NumBoxes+=1; RandomRect[NumBoxes-1]=ManualRect(); } else { RandomRect[TempNum-1]=ManualRect(); } break; case '2': printf("\n\nEnter The Rectangle Number You'd Like To Delete: "); scanf("%i",&TempNum); for (int i=0; i < (NumBoxes); i++) { RandomRect[TempNum-2+i]=RandomRect[TempNum-1+i]; } NumBoxes-=1; break; default: printf("\n Either Invalid Selection or Not yet implemented feature :("); } getch(); } getch(); return 0; }
void PrintBranch(int i, Branch_t * b) { fprintf(stderr, " child[%d] X%X\n", i, (unsigned int) b->child); PrintRect(&(b->rect)); }
//Main Function-------------------------------------------------------------------------------- int main() { srand(time (NULL)); struct Rectangle RandomRect[MAX_RECTS]; Rectangle r; bool Run = true; int NumBoxes= 100; int TempNum,TempNum2,TempNum3; //How many you want? while (NumBoxes>25) { printf(" How many boxes you want? (max 25): "); scanf("%i",&NumBoxes); } //Initialize Boxes for (int i=0; i < MAX_RECTS; i++) { RandomRect[i] = GenRect(); } //Main Run Loop while (Run=true) { printf("%i",NumBoxes); PrintRect(RandomRect, NumBoxes); switch (menu()) { case '1': printf("\n\nEnter the rectangle number you'd like to write to: "); scanf("%i",&TempNum); if (TempNum>NumBoxes) { NumBoxes+=1; RandomRect[NumBoxes-1]=ManualRect(); } else { RandomRect[TempNum-1]=ManualRect(); } break; case '2': printf("\n\nEnter the rectangle number you'd like to delete: "); scanf("%i",&TempNum); for (int i=0; i < (NumBoxes); i++) { RandomRect[TempNum-2+i]=RandomRect[TempNum-1+i]; } NumBoxes-=1; break; case '3': printf("\n\nEnter the first rectangle to compare: "); scanf("%i",&TempNum); printf("\n\nEnter the second rectangle to compare: "); scanf("%i",&TempNum2); Intersection(RandomRect[TempNum-1],RandomRect[TempNum2-1]); break; case '6': printf("\n\nEnter the X coodinate: "); scanf("%i",&TempNum); printf("\n\nEnter the X coodinate: "); scanf("%i",&TempNum2); printf("\n\nEnter the rectangle to compare: "); scanf("%i",&TempNum3); printf("\n%s",PointWithin(RandomRect[TempNum3],TempNum,TempNum2)) case '7': Run=false; break; default: printf("\n Either invalid selection or not yet implemented feature :("); } } getch(); return 0; }