Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. public LinkedHashMap<Integer, Integer> createConfigurationXml (Cursor c)
  2. {
  3. LinkedHashMap<Integer, Integer> cosMarkerRelation = new LinkedHashMap<Integer, Integer>();
  4. String sensorID = "ArBusterSensor";
  5. String maxObjectsToDetectPerFrame = "5";
  6. String maxObjectsToTrackInParallel = "5";
  7. String xmlHeader = "<?xml version='1.0' encoding='UTF-8'?><TrackingData> <Sensors> <Sensor subtype='FAST' type='FeatureBasedSensorSource'> <SensorID>"+sensorID+"</SensorID> <Parameters> <MaxObjectsToDetectPerFrame>"+maxObjectsToDetectPerFrame+"</MaxObjectsToDetectPerFrame> <MaxObjectsToTrackInParallel>"+maxObjectsToTrackInParallel+"</MaxObjectsToTrackInParallel> </Parameters>";
  8. String xmlMiddle = "</Sensor> </Sensors> <Connections> ";
  9. String xmlFooter = "</Connections></TrackingData>";
  10. String xmlMarkerHeader = "";
  11. String xmlMarkerConfiguration = "";
  12.  
  13. int i=1;
  14. c.moveToFirst();
  15. do
  16. {
  17. xmlMarkerHeader += "<SensorCOS> <SensorCosID>"+c.getString(c.getColumnIndex("marker_id"))+"</SensorCosID> <Parameters> <SimilarityThreshold>0.7</SimilarityThreshold> <ReferenceImage HeightMM='200' WidthMM='200'>"+c.getString(c.getColumnIndex("marker_name"))+"</ReferenceImage> </Parameters> </SensorCOS>";
  18. xmlMarkerConfiguration += "<COS> <Name>"+c.getString(c.getColumnIndex("marker_id"))+"</Name> <Fuser type='SmoothingFuser'> <Parameters> <AlphaRotation>0.5</AlphaRotation> <AlphaTranslation>0.8</AlphaTranslation> <GammaRotation>0.5</GammaRotation> <GammaTranslation>0.8</GammaTranslation> <KeepPoseForNumberOfFrames>0</KeepPoseForNumberOfFrames> </Parameters> </Fuser> <SensorSource trigger='1'> <SensorID>"+sensorID+"</SensorID> <SensorCosID>"+c.getString(c.getColumnIndex("marker_id"))+"</SensorCosID> <HandEyeCalibration> <TranslationOffset> <x>0</x> <y>0</y> <z>0</z> </TranslationOffset> <RotationOffset> <x>0</x> <y>0</y> <z>0</z> <w>1</w> </RotationOffset> </HandEyeCalibration> <COSOffset> <TranslationOffset> <x>0</x> <y>0</y> <z>0</z> </TranslationOffset> <RotationOffset> <x>0</x> <y>0</y> <z>0</z> <w>1</w> </RotationOffset> </COSOffset> </SensorSource> </COS>";
  19. cosMarkerRelation.put(i, c.getInt(c.getColumnIndex("animation_id")));
  20. i++;
  21. }while(c.moveToNext());
  22.  
  23. String fullXml = xmlHeader+xmlMarkerHeader+xmlMiddle+xmlMarkerConfiguration+xmlFooter;
  24.  
  25. writeToFile(fullXml, xmlFilePath, xmlFileName);
  26.  
  27. return cosMarkerRelation;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement