Changeset 127 in main


Ignore:
Timestamp:
07/23/10 13:28:48 (11 years ago)
Author:
pjoulaud
Message:

optimization of navigate function

Location:
trunk/openPLM
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/media/openplm.css

    r124 r127  
    88body  
    99{ 
    10 background-color: #b3b3b3; 
    11 /*background-image: url(img/ciel_etoile111.jpg);*/ 
     10/* background-color: #b3b3b3; */ 
     11background: #b3b3b3 url(/media/img/openplm.png) no-repeat right top fixed; 
    1212font-family: Comic Sans MS, Verdana, Arial, sans-serif; 
    1313text-align: center; 
     
    3737#HomePage 
    3838{ 
    39 background-color: #ffffff;       
     39background: #ffffff url(/media/img/foot-complet.gif) no-repeat bottom right; 
    4040width: 1200px; 
    4141/* filter: alpha(opacity=90); */ 
    42 opacity: 0.90;  
     42/* opacity: 0.90; */ 
    4343} 
    4444 
     
    6666float: right; 
    6767width: 800px; 
     68margin-bottom: 90px; 
    6869} 
    6970 
  • trunk/openPLM/plmapp/views.py

    r124 r127  
    2323from openPLM.plmapp.api import get_obj_by_id 
    2424 
    25 import Image 
     25import re 
     26 
     27# import Image 
    2628 
    2729########################################################################################## 
     
    6870def display_global_page(request_dict): 
    6971    """ Get a request and return a dictionnary with elements common to all pages """ 
    70 #    log_in_person="pjoulaud" 
    7172    context_dict = {'log_in_person' : request_dict.user} 
    7273    query_dict = {} 
     
    740741###                     Manage html pages for navigate function                        ### 
    741742##########################################################################################     
     743regex_pattern = re.compile(r'coords\=\"(\d{1,5}),(\d{1,5}),(\d{1,5}),(\d{1,5})') 
    742744@login_required 
    743745def navigate(request, object_type_value, object_reference_value, object_revision_value):    
     
    876878                        +str(int(filter_object_form_instance.cleaned_data['User'])) 
    877879        map_path= picture_path + ".map" 
     880        dot_path= picture_path + ".dot" 
    878881        picture_path +=".gif" 
     882        navigate_graph.draw(dot_path, format='dot', prog='dot') 
    879883        navigate_graph.draw(picture_path, format='gif', prog='neato') 
    880         navigate_graph.draw(map_path, format='imap', prog='neato') 
     884        navigate_graph.draw(map_path, format='cmapx', prog='neato') 
    881885        file_object = open(map_path,"rb",0) 
    882886        map_string = file_object.read() 
    883887        file_object.close() 
    884         map_list = map_string.split("\n") 
    885         del map_list[0] 
    886         del map_list[-1] 
    887         i = 0 
    888         for map_line in map_list : 
    889             map_line_item = map_line.split(" ") 
    890             if len(map_line_item)>4: 
    891                 for j in range(2, len(map_line_item)-2): 
    892                     map_line_item[1] += " " + map_line_item[j] 
    893                     del map_line_item[j] 
    894             if len(map_line_item)==4: 
    895                 map_list[i]={'shape': map_line_item[0], 'url': map_line_item[1],\ 
    896                              '1st_point': map_line_item[2], '2nd_point': map_line_item[3]} 
    897             i+=1 
    898         x_1st_point_part_node, y_1st_point_part_node = map_list[0]['1st_point'].split(",") 
    899         x_2nd_point_part_node, y_2nd_point_part_node = map_list[0]['2nd_point'].split(",") 
    900         x_part_node_position = (int(x_1st_point_part_node)+int(x_2nd_point_part_node))/2 
    901         y_part_node_position = (int(y_1st_point_part_node)+int(y_2nd_point_part_node))/2 
     888        x_1st_point, y_1st_point, x_2nd_point, y_2nd_point = re.search(regex_pattern, map_string).groups() 
     889        x_part_node_position = (int(x_1st_point)+int(x_2nd_point))/2 
     890        y_part_node_position = (int(y_1st_point)+int(y_2nd_point))/2 
    902891        x_img_position_corrected = 790/2 - int(x_part_node_position) -100 
    903892        y_img_position_corrected = 405/2 - int(y_part_node_position) 
    904893        context_dict.update(var_dict) 
    905894        context_dict.update({'class4div': class_for_div, 'filter_object_form': filter_object_form_instance ,\ 
    906                             'map_areas': map_list, 'picture_path': "/"+picture_path,\ 
     895                            'map_areas': map_string, 'picture_path': "/"+picture_path,\ 
    907896                             'x_img_position': int(x_img_position_corrected),\ 
    908897                             'y_img_position': int(y_img_position_corrected)}) 
  • trunk/openPLM/templates/BaseDisplayHomePage.htm

    r121 r127  
    4343                </div> 
    4444                <br class="clear" /> 
    45         </div> 
    46     <div id="Footer" > 
    47      
    4845    </div> 
    4946</center> 
  • trunk/openPLM/templates/Navigate.htm

    r121 r127  
    1313         
    1414        <img class="img_nav" style="left:{{x_img_position}}px; top:{{y_img_position}}px;" 
    15                  src="{{picture_path}}" usemap="#navigatemap" title="Navigate" alt="Navigate" /> 
    16         <map id="navigatemap" name="navigatemap"> 
    17             {%for map_line in map_areas%} 
    18                 <area href="{{map_line.url}}" shape="{{map_line.shape}}"  
    19                     title="{{map_line.url}}" coords="{{map_line.1st_point}},{{map_line.2nd_point}}" /> 
    20             {%endfor%} 
    21         </map> 
     15                 src="{{picture_path}}" usemap="#_anonymous_0" title="Navigate" alt="Navigate" /> 
     16        {{map_areas|safe}} 
    2217         
    2318    </div> 
Note: See TracChangeset for help on using the changeset viewer.