Selaa lähdekoodia

changed json file

bscheibel 4 vuotta sitten
vanhempi
commit
40df4ce103
4 muutettua tiedostoa jossa 56 lisäystä ja 59 poistoa
  1. 28 51
      app/config.json
  2. 1 1
      app/static/js/js_libs/ui.js
  3. 15 3
      app/templates/index.html
  4. 12 4
      app/views.py

+ 28 - 51
app/config.json

@@ -1,121 +1,98 @@
 {
    "Ra":{
       "ISO4287":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Begriffe":8,
+         "Definition":17
       }
    },
    "Rpk":{
-      "ISO4287":{
-         "Symbole":1,
+      "ISO13565-2":{
+         "Begriffe":8,
          "Tabelle":2,
          "Definition":3
       }
    },
    "Rz":{
       "ISO14405-1":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Begriffe":8,
+         "Definition":14
       }
    },
    "CT":{
       "ISO14405-1":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":28,
+         "Begriffe":13
       }
    },
    "GX":{
       "ISO14405-1":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":29,
+         "Begriffe":13
       }
    },
    "GG":{
       "ISO14405-1":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":28,
+         "Begriffe":13
       }
    },
    "H\\d{1,2}":{
       "ISO286-1":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Begriffe":10,
+         "Passungssystem":37,
+         "Tabelle":29
       }
    },
    "h\\d{1,2}":{
       "ISO286-1":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Begriffe":10,
+         "Passungssystem":37,
+         "Tabelle":29
       }
    },
    "M\\d{1,2}":{
-      "ISO6410":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+      "ISO6410-1":{
+         "Maßeintragung":5
       }
    },
    "\u27C2":{
       "ISO1101":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":21
       }
    },
    "\u25CE":{
       "ISO1101":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":21
       }
    },
    "\u232D":{
       "ISO1101":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":21
       }
    },
    "\u2225":{
       "ISO1101":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":21
       }
    },
    "\u232F":{
       "ISO1101":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":21
       }
    },
    "\u2316":{
       "ISO1101":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":21
       }
    },
    "\u2313":{
       "ISO1101":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":21
       }
    },
    "\u23E5":{
       "ISO1101":{
-         "Symbole":1,
-         "Tabelle":2,
-         "Definition":3
+         "Symbole":21
       }
    }
 }

+ 1 - 1
app/static/js/js_libs/ui.js

@@ -63,7 +63,7 @@ function create_new_tab(title, id,terms) {
     var array_terms = JSON.parse(terms);
     var len = Object.keys(array_terms).length;
     console.log(len);
-    textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','start')> Start of ISO File. </a><br>";
+    textElement.innerHTML += "<a onclick=change_isos_tab('"+id+"','start')> Start of ISO document </a><br>";
     for (var key in array_terms) {
         console.log(key);
         //theDiv.appendChild(document.createTextNode(terms[key]));

+ 15 - 3
app/templates/index.html

@@ -196,7 +196,8 @@
 
         $("input[type=number]").focus(function(){
 
-            // highlight values, does not work so far
+
+
 
             var number = $(this).attr('name');
             var coords = $(this).attr('data-coords');
@@ -236,10 +237,21 @@
        let height = $("#drawing").height();
        let rel_width = coords_width/h*width*1.4;
        let rel_height = coords_height/w*height*1.4;
+       var orientation = "{{orientation}}";
+       var x = 0;
+       var y = 0;
+
+       if (orientation == "landscape"){
+            x = width*(coords_x*height/width/w);
+            y = height*(coords_y*width/height/h);
+       }
+       else {
+
+            x = width*(coords_x/w);
+            y = height*(coords_y/h);
+       }
 
-       let x = width*(coords_x*height/width/w);
 
-       let y = height*(coords_y*width/height/h);
        console.log(w, h, rel_width, rel_height,x,y);
 
        let $point1 = jQuery("<div class="+color+"/>").css({top: (drawing_y + y -5) + 'px', left: (drawing_x + x-5) + 'px', width: rel_width , height: rel_height});

+ 12 - 4
app/views.py

@@ -38,9 +38,17 @@ def get_file_size(file):
 
     w = p.mediaBox.getWidth()
     h= p.mediaBox.getHeight()
+    OrientationDegrees = p.get('/Rotate')
+    if OrientationDegrees != 0 :
+        orientation = "landscape"
+    else:
+        orientation = "portrait"
+
+    print(w,h,OrientationDegrees)
+    return w,h, orientation
+
+
 
-    print(w,h)
-    return w,h
 
 def check_config_file(d):
     reg_search = d
@@ -115,7 +123,7 @@ def uploaded_file(filename, uuid):
     #if request.method == 'POST':
     #    uuid = 433
     if filename.endswith(".pdf") or filename.endswith(".PDF"):
-        w,h = get_file_size(UPLOAD_FOLDER +"/" + filename)
+        w,h, orientation = get_file_size(UPLOAD_FOLDER +"/" + filename)
         convert_pdf_img(filename)
         db = redis.Redis("localhost")
         #isos = db.get(uuid+"dims")
@@ -215,7 +223,7 @@ def uploaded_file(filename, uuid):
                     html_links += "<a onclick =ui_add_tab_active('#main','" + link + "','" + link +"',true,'isotab','empty')> Open " + link + "</a> <br>"
                     #html_links += "<tr> <td> <a onclick =ui_add_tab_active('#main','iso1','iso1',true,'isotab')> Open " + link + " in Tab </a> </td> </tr>"""
         #print("teeest")
-        return render_template('index.html', filename=file_out, isos=isos, dims=dims, text=html_code,html_general=html_general, number=number_blocks, og_filename=filename, w=w, h=h, html_links=html_links, isos_names=isos_names)
+        return render_template('index.html', filename=file_out, isos=isos, dims=dims, text=html_code,html_general=html_general, number=number_blocks, og_filename=filename, w=w, h=h, html_links=html_links, isos_names=isos_names, orientation=orientation)
     #return render_template('test_pdfjs_textlayer.html', og_filename=filename)
 
     #else: