Changeset 2276
- Timestamp:
- 11/28/10 09:58:13 (18 months ago)
- Location:
- trunk
- Files:
-
- 22 edited
-
common/lodb/blocs/subbloc.py (modified) (2 diffs)
-
common/lodb/blocs/units_cars.py (modified) (3 diffs)
-
common/lodb/blocs/units_fortification.py (modified) (1 diff)
-
common/lodb/blocs/units_helicopters.py (modified) (1 diff)
-
common/lodb/blocs/units_planes.py (modified) (3 diffs)
-
common/lodb/blocs/units_ships.py (modified) (3 diffs)
-
common/lodb/lodbmanager.py (modified) (1 diff)
-
common/miztools/mizfile.py (modified) (6 diffs)
-
common/miztools/mizmerge.py (modified) (2 diffs)
-
data/airports/airports.xml (modified) (10 diffs)
-
lodyn/development.db (modified) (previous)
-
lodyn/lodyn/controllers/campaign.py (modified) (2 diffs)
-
lodyn/lodyn/controllers/mission.py (modified) (2 diffs)
-
lodyn/lodyn/controllers/objective.py (modified) (1 diff)
-
lodyn/lodyn/lib/campaignmanager.py (modified) (4 diffs)
-
lodyn/lodyn/lib/lodyn_client.py (modified) (1 diff)
-
lodyn/lodyn/lib/mission_loader.py (modified) (10 diffs)
-
lodyn/lodyn/lib/utils.py (modified) (3 diffs)
-
lodyn/lodyn/public/dijit/themes/claro/document.css (modified) (1 diff)
-
lodyn/lodyn/public/js/map.js (modified) (1 diff)
-
lodyn/lodyn/templates/derived/page/campaign.html (modified) (1 diff)
-
lodyn/lodyn/websetup.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/lodb/blocs/subbloc.py
r2163 r2276 39 39 # @param self instance class 40 40 def __getitem__( self, value ): 41 if value.lower() == "clsid" and self.real_clsid : return self.real_clsid 42 41 43 if not self.cache.has_key( value ): 42 44 self._get_item( value ) … … 82 84 if v_id.lower() == "clsid": 83 85 resultat[v_id.lower()] = m.group("value").lower() 86 resultat["real_clsid"] = m.group("value") 84 87 else: 85 88 resultat[v_id.lower()] = m.group("value") -
trunk/common/lodb/blocs/units_cars.py
r2027 r2276 29 29 def __init__( self ): 30 30 super( Units_carsBloc, self ).__init__() 31 self. car_bloc = subcarsbloc.SubCarsBloc()31 self.sub_bloc = subcarsbloc.SubCarsBloc() 32 32 #---------------------------------------------------------------- 33 33 ## Get function … … 35 35 def _get_item( self, value ): 36 36 resultat = {} 37 for root, dirs, files in os.walk(self. car_bloc.path):37 for root, dirs, files in os.walk(self.sub_bloc.path): 38 38 for name in files: 39 39 if value in name: 40 r = self. car_bloc[ os.path.join(root, name).replace( self.file, "" ) ]40 r = self.sub_bloc[ os.path.join(root, name).replace( self.file, "" ) ] 41 41 if r["name"] == value: 42 42 self.cache[value] = r … … 53 53 54 54 #- Browse directory 55 for root, dirs, files in os.walk(self. car_bloc.path):55 for root, dirs, files in os.walk(self.sub_bloc.path): 56 56 for name in files: 57 57 if name.endswith(".lua"): 58 resultat = self. car_bloc[ os.path.join(root, name).replace( self.file, "" ) ]58 resultat = self.sub_bloc[ os.path.join(root, name).replace( self.file, "" ) ] 59 59 self.cache[resultat["name"].lower()] = resultat 60 60 self.cache_clsid[resultat["clsid"].lower()] = resultat -
trunk/common/lodb/blocs/units_fortification.py
r2195 r2276 39 39 if m_s: 40 40 for m in m_s: 41 d = {'clsid':m[0] .lower()}41 d = {'clsid':m[0]} 42 42 i = 1 43 43 for item in ["name", "t_name"]: -
trunk/common/lodb/blocs/units_helicopters.py
r1959 r2276 30 30 def __init__( self ): 31 31 super( Units_helicoptersBloc, self ).__init__() 32 self. plane_bloc = subhelicoptersbloc.SubHelicoptersBloc()32 self.sub_bloc = subhelicoptersbloc.SubHelicoptersBloc() -
trunk/common/lodb/blocs/units_planes.py
r2037 r2276 30 30 def __init__( self ): 31 31 super( Units_planesBloc, self ).__init__() 32 self. plane_bloc = subplanesbloc.SubPlanesBloc()32 self.sub_bloc = subplanesbloc.SubPlanesBloc() 33 33 #---------------------------------------------------------------- 34 34 ## Get function … … 38 38 m = self._get_matcher_for( self.regex%value ) 39 39 if m: 40 resultat = self. plane_bloc[ m.group("file") + ".lua" ]40 resultat = self.sub_bloc[ m.group("file") + ".lua" ] 41 41 self.cache_clsid[resultat["clsid"].lower()] = resultat 42 42 self.cache[value] = resultat … … 52 52 file = m 53 53 i = 0 54 resultat = self. plane_bloc[ file + ".lua" ]54 resultat = self.sub_bloc[ file + ".lua" ] 55 55 self.cache[resultat['name'].lower()] = resultat 56 56 self.cache_clsid[resultat["clsid"].lower()] = resultat -
trunk/common/lodb/blocs/units_ships.py
r2037 r2276 29 29 def __init__( self ): 30 30 super( Units_shipsBloc, self ).__init__() 31 self.s hip_bloc = subshipsbloc.SubShipsBloc()31 self.sub_bloc = subshipsbloc.SubShipsBloc() 32 32 #---------------------------------------------------------------- 33 33 ## Get function … … 35 35 def _get_item( self, value ): 36 36 resultat = {} 37 for root, dirs, files in os.walk(self.s hip_bloc.path):37 for root, dirs, files in os.walk(self.sub_bloc.path): 38 38 for name in files: 39 39 if value in name: 40 r = self.s hip_bloc[ os.path.join(root, name).replace( self.file, "" ) ]40 r = self.sub_bloc[ os.path.join(root, name).replace( self.file, "" ) ] 41 41 if r["name"] == value: 42 42 self.cache[value] = r … … 53 53 54 54 #- Browse directory 55 for root, dirs, files in os.walk(self.s hip_bloc.path):55 for root, dirs, files in os.walk(self.sub_bloc.path): 56 56 for name in files: 57 57 if name.endswith(".lua"): 58 resultat = self.s hip_bloc[ os.path.join(root, name).replace( self.file, "" ) ]58 resultat = self.sub_bloc[ os.path.join(root, name).replace( self.file, "" ) ] 59 59 self.cache[resultat["name"].lower()] = resultat 60 60 self.cache_clsid[resultat["clsid"].lower()] = resultat -
trunk/common/lodb/lodbmanager.py
r2213 r2276 267 267 # db = LoDBManager( "C:\Program Files\Eagle Dynamics\LockOn Flaming Cliffs 2\Scripts\Database") 268 268 db = LoDBManager( ".", os.path.join(os.getcwd(), "common/files/FC2"), list_all=True) 269 print db[db.COUNTRIES][" usa"]["planes"]["f-15c"]["colorschemes"].items()[0][1].__dict__269 print db[db.COUNTRIES]["russia"]["planes"]["mig-29s"]["clsid"] 270 270 # pprint.pprint( db[db.WEAPONS]['pods']['launchers']) 271 271 # pprint.pprint( db[db.UNITS_PLANES]["Su-27"]["pylons"]) -
trunk/common/miztools/mizfile.py
r2268 r2276 204 204 n = int( u["unitId"] ) 205 205 self.cur_unitId = max(n+1, self.cur_unitId ) 206 if self.cur_unitId < 0: self.cur_unitId = 0 206 207 #---------------------------------------------------------------- 207 208 ## Retrieve group id … … 214 215 n = int( g["groupId"] ) 215 216 self.cur_groupId = max(n+1, self.cur_groupId ) 217 if self.cur_groupId < 0: self.cur_groupId = 0 216 218 #---------------------------------------------------------------- 217 219 ## Clone units … … 286 288 for g in mission.get_groups(coa): 287 289 if g["name"] == group_name: 288 print "-- duplicate grp", group_name 290 print "-- duplicate grp", group_name, config['activation_time'] 289 291 n_gs = g.parent.duplicate_child( g, config['group_dup']) 290 292 g_id = 1 291 if config['activation_time'] == -1: 292 time = random.randint(1,60) 293 g['start_time'] = time*60 293 if int(config['activation_time']) == -1: 294 a_time = random.randint(1,60) 295 g['start_time'] = a_time*60 296 print "SET START_TIME (0)", g["start_time"] 294 297 for n_g in n_gs: 295 298 #- Fix groupId … … 297 300 self.cur_groupId += 1 298 301 299 if config['activation_time'] != 0: 300 time = int(config['activation_time']) 301 if time < 0: 302 time = random.randint(1,60) 303 n_g['start_time'] = time*60 302 a_time = int(config['activation_time']) 303 print " -time", a_time 304 if a_time != 0: 305 if a_time < 0: 306 a_time = random.randint(1,60) 307 n_g['start_time'] = a_time*60 304 308 else: 305 n_g['start_time'] = g_id*time*60 309 n_g['start_time'] = g_id*a_time*60 310 print "SET START_TIME", n_g["start_time"] 306 311 307 312 #- Fix callsigns, unitId … … 309 314 callsign = u['callsign'] 310 315 if callsign: 311 callsign['[ 2]'] = str(g_id+1)316 callsign['[3]'] = str(g_id+1) 312 317 m = re.match(r"(\D+)(\d+)", callsign['name']) 313 318 if m: … … 339 344 mission = self.miz_loader.mission 340 345 #- retrieve higher unitId 341 for t in mission["mission"]["triggers"]["zones"].childs: 342 t['hidden'] = 'true' 346 try: 347 for t in mission["mission"]["triggers"]["zones"].childs: 348 t['hidden'] = 'true' 349 except: 350 return 343 351 #---------------------------------------------------------------- 344 352 ## Ensure item is uniq -
trunk/common/miztools/mizmerge.py
r2211 r2276 76 76 [ur'a_deactivate_group\(\\\"([^\"]+)\\\"\)', ur'a_deactivate_group(\\"%s\\")', ur'$|group_name_%d_\1|', True], 77 77 #--- TODO need validate next lines 78 [ur'a_explosion_unit\(\\\"([^\"]+)\\\"', ur'a_explosion_unit(\\"%s ', ur'$|unit_name_%d_\1|', False],78 [ur'a_explosion_unit\(\\\"([^\"]+)\\\"', ur'a_explosion_unit(\\"%s\\"', ur'$|unit_%d_\1|', False], 79 79 [ur'a_explosion_marker_unit\(\\\"([^\"]+)\\\"', ur'a_explosion_marker_unit(\\"%s\\"', ur'$|unit_name_%d_\1|', False], 80 80 [ur'a_signal_flare_unit\(\\\"([^\"]+)\\\"', ur'a_signal_flare_unit(\\"%s\\"', ur'$|unit_name_%d_\1|', False], … … 205 205 n += 1 206 206 207 # print tmpl_dico 207 import pprint 208 pprint.pprint( tmpl_dico["unit_id"] ) 208 209 #- compute 209 210 buff = miz.get_mission_buffer().decode('utf-8', 'replace') -
trunk/data/airports/airports.xml
r2213 r2276 219 219 country="Russia" 220 220 side="Red" 221 lofc2_id="1 8"221 lofc2_id="19" 222 222 kfu="5" 223 223 real_angle="47" … … 260 260 country="Russia" 261 261 side="Red" 262 lofc2_id="1 7"262 lofc2_id="18" 263 263 kfu="6" 264 264 real_angle="62" … … 349 349 country="Georgia" 350 350 side="Blue" 351 lofc2_id="2 0"351 lofc2_id="21" 352 352 kfu="33" 353 353 real_angle="331" … … 365 365 country="Georgia" 366 366 side="Blue" 367 lofc2_id=" 19"367 lofc2_id="20" 368 368 kfu="30" 369 369 real_angle="296" … … 382 382 country="Russia" 383 383 side="Red" 384 lofc2_id="2 5"384 lofc2_id="26" 385 385 kfu="12" 386 386 real_angle="295" … … 398 398 country="Russia" 399 399 side="Red" 400 lofc2_id="2 6"400 lofc2_id="27" 401 401 kfu="6" 402 402 real_angle="236" … … 414 414 country="Georgia" 415 415 side="Blue" 416 lofc2_id="2 2"416 lofc2_id="23" 417 417 kfu="9" 418 418 real_angle="89" … … 430 430 country="Georgia" 431 431 side="Blue" 432 lofc2_id="2 4"432 lofc2_id="25" 433 433 kfu="8" 434 434 real_angle="74" … … 446 446 country="Georgia" 447 447 side="Blue" 448 lofc2_id="2 3"448 lofc2_id="24" 449 449 kfu="7" 450 450 real_angle="70" … … 462 462 country="Georgia" 463 463 side="Blue" 464 lofc2_id="2 1"464 lofc2_id="22" 465 465 kfu="13" 466 466 real_angle="125" -
trunk/lodyn/lodyn/controllers/campaign.py
r2249 r2276 314 314 return {'response': True} 315 315 #---------------------------------------------------------------- 316 @ActionProtector( has_permission('creator'))316 @ActionProtector(not_anonymous()) 317 317 @jsonify 318 318 def getallgroups(self): 319 """ Get all airports """320 values = dict(request.params) 321 322 try: 323 name = values['name']319 """ Get all groups """ 320 values = dict(request.params) 321 322 try: 323 id = values['id'] 324 324 except: 325 325 return {'response': False, 'reason':_("Bad parameters") } … … 328 328 d = { 'response': True, 'label': 'name', 'value': 'name', 'items':[]} 329 329 330 camp = obj_q. filter_by(name=name).first()331 if not camp: return {'response': False, 'reason':_("Campaign not found") } 332 333 obj_q = meta.Session.query(model.L oGroup)334 route_q = meta.Session.query(model.LoRoute)330 camp = obj_q.get(uuid.UUID(id)) 331 if not camp: return {'response': False, 'reason':_("Campaign not found") } 332 333 obj_q = meta.Session.query(model.LObjective) 334 db_route_q = meta.Session.query(model.LoRoute) 335 335 db_loobj_q = meta.Session.query(model.LoObject) 336 for obj in obj_q.filter_by(campaign_id=camp.id).all():337 points = []338 if not obj .route_id: continue339 route = route_q.get( obj.route_id )340 for p in route.points:341 points.append( { 'lat': p.lat, 'long': p.long } )342 mapclasskey = ""343 if obj.lounits:344 loo = db_loobj_q.get( obj.lounits[0].loobject_id )345 if loo: mapclasskey = loo.mapclasskey 346 t_d = {347 'name':obj.name,348 'mapclasskey':mapclasskey.replace("P00", "P"),349 'points': points350 }351 t_d.update( obj.to_json() )352 d['items'].append( t_d)336 mizfile_q = meta.Session.query(model.LMizFile) 337 for obj in camp.objectives: 338 if not obj: continue 339 if h.auth.is_creator(request.environ): 340 a = {"objective" : obj.to_json() } 341 else: 342 a = {"objective" : obj.to_json( 343 only_objectives_visible=True) } 344 if not a["objective"] : continue 345 346 mizfile = mizfile_q.get( obj.mizfile_id ) 347 if not mizfile: continue 348 for grp in mizfile.groups: 349 t_d = h.utils.fill_group_with_route( grp, db_route_q, db_loobj_q ) 350 if t_d: 351 a["group"] = t_d 352 d['items'].append( a ) 353 353 return d 354 354 #---------------------------------------------------------------- -
trunk/lodyn/lodyn/controllers/mission.py
r2261 r2276 511 511 obj.squadrons_datas[ squad_id ] = {} 512 512 obj.squadrons_datas[squad_id]["airport_id"] = airport_id 513 print squad.name, "based now at", airport.name 513 514 514 515 meta.Session.commit() … … 650 651 for obj in mis.campaign.objectives: 651 652 obj.status = obj.ACTIVE 652 mis.objectives.append( obj )653 meta.Session.commit() 654 d["response"] = app_globals.campaign_manager.generate( mis )653 #mis.objectives.append( obj ) 654 meta.Session.commit() 655 #d["response"] = app_globals.campaign_manager.generate( mis ) 655 656 656 657 d = {'response': True} 657 d.update(mis.to_json(full=True, nofulllmizfile=True)) 658 #d.update(mis.to_json(full=True, nofulllmizfile=True)) 659 print "generate ok" 658 660 return d 659 661 #---------------------------------------------------------------- -
trunk/lodyn/lodyn/controllers/objective.py
r2255 r2276 615 615 defs.battalion_cfg['points'][group_id] = {} 616 616 pos_conv = PositionConverter() 617 x, y= pos_conv(float(lat),float(long))617 y, x = pos_conv(float(lat),float(long)) 618 618 defs.battalion_cfg['points'][group_id][str(int(waypoint)+1)] = {"lat":float(lat), "long": float(long), "x":x, "y":y } 619 619 meta.Session.commit() -
trunk/lodyn/lodyn/lib/campaignmanager.py
r2269 r2276 23 23 def __init__(self): 24 24 self.campaigns = {} 25 self.auto_add_obj_radius = 50*1000 #- in meter25 self.auto_add_obj_radius = 200*1000 #- in meter 26 26 self.objectives_nb_limit = 5 #- nb of objectives max to add 27 27 #------------------------------------------------------- … … 71 71 def update(self, db_c): 72 72 if not self.campaigns.has_key( db_c.name ): return 73 #return 73 74 74 75 camp = self.campaigns[db_c.name] … … 93 94 mizfile = db_mizfile_q.get( obj.mizfile_id ) 94 95 if not mizfile: continue 96 if not mizfile.groups: 97 print "ERROR WITH", mizfile.filename 98 continue 99 if not mizfile.groups: continue 95 100 group = mizfile.groups[0] 101 if not group: continue 102 if not group.route_id: continue 96 103 route = db_route_q.get( group.route_id) 97 104 obj_pos[obj.id] = { "x": route.points[0].x, "y":route.points[0].y } … … 103 110 mizfile = db_mizfile_q.get( obj.mizfile_id ) 104 111 if not mizfile: continue 112 if not mizfile.groups: 113 print "ERROR WITH", mizfile.filename 114 continue 115 if not mizfile.groups: continue 105 116 group = mizfile.groups[0] 117 if not group: continue 118 if not group.route_id: continue 106 119 route = db_route_q.get( group.route_id) 107 120 -
trunk/lodyn/lodyn/lib/lodyn_client.py
r2241 r2276 102 102 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 103 103 try: 104 #sock.connect( ( '192.168.1.1', CST_LODYN_PORT)) 104 105 sock.connect( ( 'localhost', CST_LODYN_PORT)) 105 106 self.cnxObj = CnxObj( sock) -
trunk/lodyn/lodyn/lib/mission_loader.py
r2269 r2276 101 101 for coa in self.coalitions.iterkeys(): 102 102 for objective in self.coalitions[coa]['objectives']: 103 if not db_mizfile_q.filter_by(filename=objective.replace( self.campaign_path, "") ).first():103 if not db_mizfile_q.filter_by(filename=objective.replace( self.campaign_path, ""), campaign_id=db_camp.id).first(): 104 104 self.load_objective( objective, coa, db_camp ) 105 105 106 106 for k, versions in self.coalitions[coa]['battalions'].iteritems(): 107 db_battalion = db_battalion_q.filter_by(name=k, coalition=coa ).first()107 db_battalion = db_battalion_q.filter_by(name=k, coalition=coa, campaign_id=db_camp.id).first() 108 108 if not db_battalion: 109 109 db_battalion = self.load_battalion( k, coa, db_camp ) 110 110 for version in versions: 111 db_version = db_mizfile_q.filter_by(filename=version.replace( self.campaign_path, "") ).first()111 db_version = db_mizfile_q.filter_by(filename=version.replace( self.campaign_path, ""), campaign_id=db_camp.id).first() 112 112 if not db_version: 113 113 self.load_battalion_version( db_battalion, version, db_camp ) 114 meta.Session.commit() 114 115 #------------------------------------------------------- 115 116 def load_use_by(self, db_camp): 116 117 """ Load all use_by files """ 117 118 print "-- LOAD USE BY--" 119 return 118 120 119 121 db_mizfile_q = meta.Session.query(model.LMizFile) … … 121 123 db_battalion_q = meta.Session.query(model.LBattalion) 122 124 123 path = os.path.join( self.campaign_path, "use_by. xls" )125 path = os.path.join( self.campaign_path, "use_by.csv" ) 124 126 try: 125 127 fd = open( path, 'r' ) 126 128 except: 129 print "-- LOAD USE BY NOT FOUND --" 127 130 return 128 131 if fd: 129 buf = fd.read() 132 buf = fd.read().decode('latin1') 130 133 fd.close() 131 134 135 i = 0 132 136 for line in buf.splitlines(): 133 137 datas = line.split(';') 138 print i, datas 134 139 if len(datas) > 1: 135 obj_name, batt_name = datas[0], datas[1] 136 db_obj = db_objective_q.filter_by(name=obj_name).first() 137 db_batt = db_battalion_q.filter_by(name=batt_name).first() 138 if db_obj and db_batt: 140 obj_name, batt_name = datas[1].strip(), datas[0].strip() 141 db_obj = db_objective_q.filter_by(name=obj_name, campaign_id=db_camp.id).first() 142 db_batt = db_battalion_q.filter_by(name=batt_name, campaign_id=db_camp.id).first() 143 print db_obj, db_batt 144 if db_obj and db_batt and (db_batt not in db_obj.use_by): 139 145 db_obj.use_by.append( db_batt ) 146 print "Add", batt_name, "in", obj_name 140 147 #- ok done, now rename the file 141 148 import shutil 142 149 shutil.copy( path, path.replace("by","by_DONE")) 143 150 meta.Session.commit() 151 print "-- LOAD USE BY DONE--" 144 152 #------------------------------------------------------- 145 153 def load_objective(self, f, coa, db_camp): … … 175 183 #------------------------------------------------------- 176 184 def load_battalion(self, battalion, coa, db_camp): 185 return 177 186 print "LOAD BATTALION" , battalion 178 187 db_battalion = LBattalion() … … 188 197 #------------------------------------------------------- 189 198 def load_battalion_version(self, db_battalion, f, db_camp): 199 return 190 200 print "LOAD BATTALION VERSION" , f 191 201 db_file = LMizFile() … … 266 276 for it in ["name", "lat", "long", "heading", "skill"]: 267 277 setattr(db_u, it, u[it]) 268 db_u.clsid = u["CLSID"] .lower()#- Force CLSID in lower case278 db_u.clsid = u["CLSID"] #- Force CLSID in lower case 269 279 270 280 #- Find loobject … … 292 302 setattr(db_p, it, p[it]) 293 303 if db_obj: 294 for trigzone in mission["mission"]["triggers"]["zones"].items(): 295 if trigzone['name'].startswith("DEFENSE_"): 296 datas = trigzone['name'].split("_", 2) 297 if len(datas) < 3: return 298 db_defense_slot = LDefenseSlot() 299 db_defense_slot.name = datas[2] 300 db_defense_slot.lat = math.degrees(float(trigzone["lat"])) 301 db_defense_slot.long = math.degrees(float(trigzone["long"])) 302 db_defense_slot.x = float(trigzone["x"]) 303 db_defense_slot.y = float(trigzone["y"]) 304 db_defense_slot.heading = int( datas[1] ) 305 db_defense_slot.objective_id = db_obj.id 306 meta.Session.add( db_defense_slot ) 307 meta.Session.commit() 308 db_obj.defenses_slots.append( db_defense_slot ) 309 elif trigzone['name'].startswith("WAYPOINT"): 310 db_obj.waypoint_lat = math.degrees(float(trigzone["lat"])) 311 db_obj.waypoint_long = math.degrees(float(trigzone["long"])) 312 db_obj.waypoint_x = float(trigzone["x"]) 313 db_obj.waypoint_y = float(trigzone["y"]) 304 if mission["mission"]["triggers"]["zones"]: 305 for trigzone in mission["mission"]["triggers"]["zones"].items(): 306 if trigzone['name'].startswith("DEFENSE_"): 307 datas = trigzone['name'].split("_", 2) 308 if len(datas) < 3: continue 309 db_defense_slot = LDefenseSlot() 310 db_defense_slot.name = datas[2] 311 db_defense_slot.lat = math.degrees(float(trigzone["lat"])) 312 db_defense_slot.long = math.degrees(float(trigzone["long"])) 313 db_defense_slot.x = float(trigzone["x"]) 314 db_defense_slot.y = float(trigzone["y"]) 315 db_defense_slot.heading = int( datas[1] ) 316 db_defense_slot.objective_id = db_obj.id 317 meta.Session.add( db_defense_slot ) 318 meta.Session.commit() 319 db_obj.defenses_slots.append( db_defense_slot ) 320 elif trigzone['name'].startswith("WAYPOINT"): 321 db_obj.waypoint_lat = math.degrees(float(trigzone["lat"])) 322 db_obj.waypoint_long = math.degrees(float(trigzone["long"])) 323 db_obj.waypoint_x = float(trigzone["x"]) 324 db_obj.waypoint_y = float(trigzone["y"]) 314 325 meta.Session.commit() 315 326 #------------------------------------------------------- … … 428 439 429 440 pos_conv = PositionConverter() 430 bulleyes_ x, bulleyes_y= pos_conv( db_mis.bulleyes_lat, db_mis.bulleyes_long )441 bulleyes_y, bulleyes_x = pos_conv( db_mis.bulleyes_lat, db_mis.bulleyes_long ) 431 442 #- retrieve higher unitId 432 443 for coa in ["blue", "red"]: … … 450 461 db_airport = db_airport_q.get( uuid.UUID(airport_id) ) 451 462 if not db_airport: continue 452 463 if "319th" in squad.name: continue 464 print squad.name, db_airport.name 453 465 454 466 mz_coalition = miz["mission"]["coalition"][PLAYER_COALITION]["country"] … … 528 540 nw = 2 529 541 for w in waypoints: 530 x, y= pos_conv( w["lat"], w["long"] )542 y, x = pos_conv( w["lat"], w["long"] ) 531 543 point_1_it = MizItem("[%d]"%nw) 532 544 points_it.merge_add_childs( point_1_it ) … … 576 588 for it in [ 577 589 ("type", loo.name, True), 578 ("CLSID", loo.clsid .upper(), True),590 ("CLSID", loo.clsid, True), 579 591 ("unitId", str(miz.cur_unitId), False), 580 592 ("lat", str(math.radians(db_airport.lat)), False), -
trunk/lodyn/lodyn/lib/utils.py
r2257 r2276 17 17 t_d = {} 18 18 points = [] 19 if not grp.route_id: return t d19 if not grp.route_id: return t_d 20 20 route = db_route_q.get( grp.route_id ) 21 21 c_points = None … … 30 30 #- First position 31 31 if config['lat'] and config['long']: 32 x, y= pos_conv(config['lat'],config['long'])32 y, x = pos_conv(config['lat'],config['long']) 33 33 points.append( { 34 34 'lat': config["lat"], … … 42 42 if c_points.has_key(k): 43 43 if c_points[k]['lat'] and c_points[k]['long']: 44 x, y= pos_conv(c_points[k]['lat'],c_points[k]['long'])44 y, x = pos_conv(c_points[k]['lat'],c_points[k]['long']) 45 45 points.append( { 46 46 'lat': c_points[k]["lat"], -
trunk/lodyn/lodyn/public/dijit/themes/claro/document.css
r2267 r2276 5 5 color: #131313; 6 6 } 7 a:link {color: #c1deff; text-decoration: underline; } 8 a:active {color: #c1deff; text-decoration: underline; } 9 a:visited {color: #c1deff; text-decoration: underline; } 10 a:hover {color: #FFFFFF; text-decoration: none; } 7 11 h1 { 8 12 font-size: 1.545em; -
trunk/lodyn/lodyn/public/js/map.js
r2247 r2276 153 153 function add_pov(id, long, lat, icon, size_x, size_y, title, label) 154 154 { 155 if( !label ) label = "";155 if( !label ) var label = ""; 156 156 var feature = new OpenLayers.Feature.Vector( 157 157 new OpenLayers.Geometry.Point( long, lat ) -
trunk/lodyn/lodyn/templates/derived/page/campaign.html
r2251 r2276 396 396 var j; 397 397 var features; 398 for( i in item.objectives ) 399 { 400 dojo.xhrPost({ 401 content : { 'id': item.objectives[i].id }, 402 url: '${h.url_for(controller="objective", action="getgroups" )}', 403 load: function(response, ioArgs) 404 { 405 var obj = dojo.fromJson(response); 406 if( obj.response ) 407 { 408 for( j in obj.items ) 409 { 410 group = obj.items[j]; 411 objective = obj.objective; 412 features = map_add_group( objective.id + "|" + group.name, group, null, objective.name ); 413 var status = objective.status; 414 % if h.auth.is_creator(request.environ): 415 if( status == 0 ) objective_inactive_layer.addFeatures( features ); 416 %endif 417 if( status == 1 ) objective_active_layer.addFeatures( features ); 418 if( status == 2 ) objective_killed_layer.addFeatures( features ); 419 } 420 }else{ 421 alert( obj.reason ); 422 } 423 } 424 }); 425 } 398 dojo.xhrPost({ 399 content : { 'id': current_camp.id }, 400 url: '${h.url_for(controller="campaign", action="getallgroups" )}', 401 load: function(response, ioArgs) 402 { 403 var obj = dojo.fromJson(response); 404 if( obj.response ) 405 { 406 for( j in obj.items ) 407 { 408 group = obj.items[j].group; 409 objective = obj.items[j].objective; 410 features = map_add_group( objective.id + "|" + group.name, group, null, objective.name ); 411 var status = objective.status; 412 % if h.auth.is_creator(request.environ): 413 if( status == 0 ) objective_inactive_layer.addFeatures( features ); 414 %endif 415 if( status == 1 ) objective_active_layer.addFeatures( features ); 416 if( status == 2 ) objective_killed_layer.addFeatures( features ); 417 } 418 }else{ 419 alert( obj.reason ); 420 } 421 } 422 }); 426 423 if( group ) map_show(group.points[0].long, group.points[0].lat, 11); 427 424 } -
trunk/lodyn/lodyn/websetup.py
r2216 r2276 111 111 ] 112 112 attributes = [ 113 "name", "clsid", "picture","shape",113 "name", "clsid", "picture","shape", 114 114 "threat_range", "detection_range", 115 115 "mapclasskey", … … 125 125 c_obj.name = db_c.name 126 126 c_obj.category = category 127 c_obj.clsid = db_c.clsid .lower()127 c_obj.clsid = db_c.clsid 128 128 c_obj.weight = db_c.weight 129 129 c_obj.picture = db_c.picture … … 140 140 c_obj.name = db_c.name 141 141 c_obj.short_name = db_c.short_name 142 c_obj.clsid = db_c.clsid .lower()142 c_obj.clsid = db_c.clsid 143 143 c_obj.lofc2_id = db_c.id 144 144 … … 157 157 if unit.has_key( att ): 158 158 setattr( obj, att, unit[att] ) 159 159 if unit.has_key("real_clsid"): 160 obj.clsid = unit["real_clsid"] 161 print obj.name, obj.clsid 160 162 #- Found country 161 163 for c in countries_list: … … 169 171 cs_obj = LoColorScheme() 170 172 cs_obj.name = cs.name 171 cs_obj.clsid = cs.clsid .lower()173 cs_obj.clsid = cs.clsid 172 174 cs_obj.lofc2_id = cs.lofc2_id 173 175 obj.color_schemes.append( cs_obj ) … … 201 203 air_o = airport[1] 202 204 obj = LoAirport() 203 obj.clsid = airport[0] .lower()205 obj.clsid = airport[0] 204 206 obj.name = air_o.name 205 207 obj.lo_lat = air_o.lo_latitude
Note: See TracChangeset
for help on using the changeset viewer.
