コード例 #1
0
 /* ----------------------------------------------------------------
 // Function Name : main
 // Date Written : 03/04/2008
 // Author : yogvinder
 // Input Parameters :
 // Output Parameters : None
 // Return Values : void
 // Description :
 // ---------------------------------------------------------------- */
 public static void main(String[] args) throws Exception {
   ServiceConfiguration.initLog();
   ServiceConfiguration.initServiceProperties(true);
   AttachAnnotationByFEAPForTransfer ap =
       new AttachAnnotationByFEAPForTransfer(
           ServiceConfiguration.serviceLog,
           "supervisor",
           "supervisor351",
           "division_060",
           "192.168.5.45",
           "3333");
   File f = new File("D:\\abc1.txt");
   FileReader fr = new FileReader(f);
   String contents = "";
   int x = 0;
   while ((x = fr.read()) != -1) {
     contents = contents + (char) x;
   }
   AnnotationBuffer abr = generateAnnotationBuffer(contents);
   System.out.println(abr);
   abr.removeAnnotation("1");
   System.out.println(abr);
 }
コード例 #2
0
 /* ----------------------------------------------------------------
 // Function Name    : generateAnnotationBuffer
 // Date Written     : 03/04/2008
 // Author           : yogvinder
 // Input Parameters :
 // Return Values    : AnnotationBuffer
 // Description      : generateAnnotationBuffer Implemented
 // ---------------------------------------------------------------- */
 public static AnnotationBuffer generateAnnotationBuffer(String annotationBuffer)
     throws NGException {
   AnnotationBuffer aBuffer = new AnnotationBuffer();
   String[] annotationBufferArray = annotationBuffer.split("[\\n\\r]+");
   int length = annotationBufferArray.length;
   if (length > 0) {
     int counter = 0;
     aBuffer.setTotalAnnotations(
         Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++])));
     aBuffer.setNoOfStamp(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++])));
     int stamplength = length - 2;
     double d = stamplength / 14;
     int stampCounter = stamplength / 14;
     for (int x = 0; x < stampCounter; x++) {
       Stamp stamp = new Stamp();
       stamp.setStampName(aBuffer.getVal1(annotationBufferArray[counter++]));
       stamp.setX1(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++])));
       stamp.setY1(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++])));
       stamp.setX2(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++])));
       stamp.setY2(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++])));
       stamp.setColor(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++])));
       stamp.setTimeOrder(aBuffer.getVal(annotationBufferArray[counter++]));
       stamp.setMouseSensivity(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++])));
       stamp.setAnnotationGroupID(aBuffer.getVal(annotationBufferArray[counter++]));
       stamp.setUserId(aBuffer.getVal(annotationBufferArray[counter++]));
       stamp.setRights(aBuffer.getVal(annotationBufferArray[counter++]));
       stamp.setType(Integer.parseInt(aBuffer.getVal(annotationBufferArray[counter++])));
       stamp.setFileName(aBuffer.getVal(annotationBufferArray[counter++]));
       stamp.setStampFileSource(aBuffer.getVal(annotationBufferArray[counter++]));
       aBuffer.add2StampList(stamp);
     }
   }
   return aBuffer;
 }