Changeset 11769
- Timestamp:
- Feb 12, 2007, 6:58:30 PM (19 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
warptool.c (modified) (1 diff)
-
warptoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/warptool.c
r11766 r11769 565 565 } 566 566 567 568 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile); 569 567 570 static bool addoverlapMode(pxConfig *config) 568 571 { 569 572 PS_ASSERT_PTR_NON_NULL(config, NULL); 573 574 bool status = false; 575 psString mapfile = psMetadataLookupStr(&status, config->args, "-mapfile"); 576 if (!status) { 577 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -mapfile"); 578 return false; 579 } 580 if (!mapfile) { 581 psError(PS_ERR_UNKNOWN, true, "-mapfile is required"); 582 return false; 583 } 584 585 if (!parseAndInsertSkyCellMap(config, mapfile)) { 586 } 587 588 return true; 589 } 590 591 592 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile) 593 { 594 unsigned int nFail = 0; 595 psMetadata *skycells = psMetadataConfigRead(NULL, &nFail, mapfile, false); 596 if (!skycells) { 597 psError(PS_ERR_UNKNOWN, false, "failed to parse mapfile: %s", mapfile); 598 return false; 599 } 600 if (nFail) { 601 psError(PS_ERR_UNKNOWN, false, "there were %d errors parsing mapfile: %s", nFail, mapfile); 602 psFree(skycells); 603 return false; 604 } 605 606 psMetadataItem *item = NULL; 607 psMetadataIterator *iter = psMetadataIteratorAlloc(skycells, 0, NULL); 608 if ((item = psMetadataGetAndIncrement(iter))) { 609 if (item->type != PS_DATA_METADATA) { 610 psError(PS_ERR_UNKNOWN, false, "mapfile: %s is in the wrong format", mapfile); 611 psFree(iter); 612 psFree(skycells); 613 return false; 614 } 615 616 psMetadata *sc = item->data.md; 617 // this conversion isn't strictly nessicary but it's an easy way of 618 // validating the format 619 p4SkyCellMapRow *row = p4SkyCellMapObjectFromMetadata(sc); 620 if (!row) { 621 psError(PS_ERR_UNKNOWN, false, "failed to convert mapfile: %s metdata entry into a p4SkyCellMap object", mapfile); 622 psFree(iter); 623 psFree(skycells); 624 return false; 625 } 626 627 if (!p4SkyCellMapInsertObject(config->dbh, row)) { 628 psError(PS_ERR_UNKNOWN, false, "failed to convert mapfile: %s metdata entry into a p4SkyCellMap object", mapfile); 629 psFree(row); 630 psFree(iter); 631 psFree(skycells); 632 return false; 633 } 634 635 psFree(row); 636 } 637 psFree(iter); 638 psFree(skycells); 639 570 640 return true; 571 641 } -
trunk/ippTools/src/warptoolConfig.c
r11765 r11769 118 118 // -addoverlap 119 119 psMetadata *addoverlapArgs = psMetadataAlloc(); 120 psMetadataAddStr(addoverlapArgs, PS_LIST_TAIL, "-p4_id", 0,121 "search by p4 ID", NULL);122 120 psMetadataAddStr(addoverlapArgs, PS_LIST_TAIL, "-mapfile", 0, 123 121 "skycell <-> imfile mapping description", NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
