#!/usr/bin/env python
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2016-2017 German Aerospace Center (DLR) and others.
# SUMOPy module
# Copyright (C) 2012-2017 University of Bologna - DICAM
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v20.html
# @file ogleditor.py
# @author Joerg Schweizer
# @date
# @version $Id$
"""OpenGL editor"""
if __name__ == '__main__':
__version__ = "0.1a"
__licence__ = """licensed under the EPL."""
__copyright__ = "(c) 2012-2017 University of Bologna - DICAM"
__author__ = "Joerg Schweizer"
__usage__ = """USAGE:
from command line:
python ogleditor.py
python ogleditor.py <scenariobasename> <scenariodir>
use for debugging
python ogleditor.py --debug > debug.txt 2>&1
"""
print __copyright__
###############################################################################
# IMPORTS
#import wxversion
# wxversion.select("2.8")
import wx
from collections import OrderedDict
from wx import glcanvas
from wx.lib.buttons import GenBitmapTextButton, GenBitmapButton
try:
from OpenGL.GL import *
from OpenGL.GLU import * # project , unproject , tess
from OpenGL.GLUT import *
from OpenGL.raw.GL.ARB.vertex_array_object import glGenVertexArrays, \
glBindVertexArray
from OpenGL.arrays import vbo
import numpy as np
except ImportError:
raise ImportError, "Required dependencies numpy or OpenGL not present"
import sys
import os
import types
if __name__ == '__main__':
try:
FILEDIR = os.path.dirname(os.path.abspath(__file__))
except:
FILEDIR = os.path.dirname(os.path.abspath(sys.argv[0]))
sys.path.append(os.path.join(FILEDIR, "..", ".."))
#IMAGEDIR = os.path.join(APPDIR,"lib_base","images")
IMAGEDIR = os.path.join(os.path.dirname(__file__), "images")
import agilepy.lib_base.classman as cm
import agilepy.lib_base.arrayman as am
from agilepy.lib_base.geometry import *
# wx gui stuff
from wxmisc import *
from toolbox import *
FLATHEAD = 0
BEVELHEAD = 1
TRIANGLEHEAD = 2
ARROWHEAD = 3
LEFTTRIANGLEHEAD = 4
RIGHTTRIANGLEHEAD = 5
LINEHEADS = { # 'flat':0,# not a style
'bevel': BEVELHEAD,
'triangle': TRIANGLEHEAD,
'arrow': ARROWHEAD,
'lefttriangle': LEFTTRIANGLEHEAD,
'righttriangle': RIGHTTRIANGLEHEAD,
}
# to be deleted
#import test_glcanvas as testogl
# class TestVbo(Vbo):
# def draw(self, resolution):
##
##
##
# print 'draw',self.get_ident(),self
# glEnableClientState(GL_VERTEX_ARRAY)
# glEnableClientState(GL_COLOR_ARRAY)
##
# self._colorvbo.bind()
## glColorPointer(4, GL_FLOAT, 0, None)
##
# self._vertexvbo.bind()
# self._indexvbo.bind()
## glVertexPointer(3, GL_FLOAT, 0, None)
##
# print ' self._n_vpo *(self._n_vpo-1)*self._n_drawobjs',self._n_vpo *(self._n_vpo-1)*self._n_drawobjs
# print ' len(self._vertexvbo)',len(self._vertexvbo)
# print ' len(self._colorvbo)',len(self._colorvbo)
# n_vpo = len(self._vertexvbo)/self._n_vpe/self._n_drawobjs+1
# glDrawElements(self._glelement, self._n_vpo *(self._n_vpo-1)*self._n_drawobjs, GL_UNSIGNED_INT, None)
## glDrawElements(self._glelement, len(self._vertexvbo), GL_UNSIGNED_INT, None)
##
# glDisableClientState(GL_VERTEX_ARRAY)
# glDisableClientState(GL_COLOR_ARRAY)
##
# self._vertexvbo.unbind()
# self._indexvbo.unbind()
# self._colorvbo.unbind()
class Vbo:
def __init__(self, ident, glelement, n_vpe, objtype=''):
self._ident = ident
self._glelement = glelement
self._n_vpe = n_vpe
self._objtype = objtype
self.reset()
def reset(self):
self._vertexvbo = None
self._indexvbo = None
self._colorvbo = None
self._inds = None
def get_objtype(self):
return self._objtype
def is_fill(self):
return self._objtype == 'fill'
def get_ident(self):
return self._ident
def get_vpe(self):
return self._n_vpe
def update_vertices(self, vertices, n=None, inds=None):
"""
n = number of draw objects
"""
self._inds = inds
# print 'update_vertices',self.get_ident(),n
self._n_drawobjs = n
#
#vertices = np.zeros((self._n_elem_fill, self._n_vpe_fill * 3),dtype=np.float32)
# len(vertices) = n_elem = (n_vpo-1)*n
#n_elem = len(vertices)/n_drawobjs+self._noncyclic
# n_vpo = vertex per draw object
# n_elem = (n_vpo-1)*n_drawobjs
# n_vpo = vertex per draw object
#self._n_vpo = n_elem/n_drawobjs+1
#n_vert = len(self._vertexvbo_fill)/self._n_vpe_fill/len(self)+1
#n_elem_fill = (n_vert-1)*n
# len(_vertexvbo_fill) = self._n_vpe * self._n_elem_fill = self._n_vpe * (n_vert-1)*n
# print ' len(vertices),n_vpo,n_elem',len(vertices),self._n_vpo,n_elem
#glDrawElements(GL_TRIANGLES, self._n_vert*self._n_elem_fill, GL_UNSIGNED_INT, None)
# self._n_vert*self._n_elem_fill = n_vert * (n_vert-1)*n
# repeat for each of the n objects: self._n_vpe_fill*(n_vert-1)
# print ' vertices=\n',vertices
# print ' vertices.reshape((-1,3))=\n',vertices.reshape((-1,3))
self._vertexvbo = vbo.VBO(vertices.reshape((-1, 3)))
self._indexvbo = vbo.VBO(np.arange(
len(self._vertexvbo), dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER)
#self._indexvbo = vbo.VBO(np.arange(len(vertices.reshape((-1,3)) ), dtype=np.int32), target=GL_ELEMENT_ARRAY_BUFFER)
def destroy(self):
del self._vertexvbo
del self._indexvbo
del self._colorvbo
self.reset()
def update_colors(self, colors):
if self._vertexvbo == None:
return
# print 'update_colors',self._n_drawobjs,len(colors)
if len(colors) == 0:
return
if self._n_drawobjs == None:
n_repreat = len(self._vertexvbo) / \
len(self._inds) # self._n_drawobjs
self._colorvbo = vbo.VBO(
np.repeat(colors[self._inds], n_repreat, 0))
else:
n_repreat = len(self._vertexvbo) / self._n_drawobjs
self._colorvbo = vbo.VBO(np.repeat(colors, n_repreat, 0))
def draw(self, resolution):
# glEnableClientState(GL_VERTEX_ARRAY)
# glEnableClientState(GL_COLOR_ARRAY)
if self._vertexvbo == None:
return
# print 'Vbo.draw',self.get_ident(),self._n_drawobjs,len(self._vertexvbo)
# if self._n_drawobjs in (0,None): return
if self._n_drawobjs == 0:
return
self._colorvbo.bind()
glColorPointer(4, GL_FLOAT, 0, None)
self._vertexvbo.bind()
self._indexvbo.bind()
glVertexPointer(3, GL_FLOAT, 0, None)
# print ' self._n_vpo *(self._n_vpo-1)*self._n_drawobjs',self._n_vpo *(self._n_vpo-1)*self._n_drawobjs
# print ' len(self._vertexvbo)',len(self._vertexvbo)
# print ' len(self._indexvbo)',len(self._indexvbo)
# print ' len(self._colorvbo)',len(self._colorvbo)
#n_vpo = len(self._vertexvbo)/self._n_vpe/self._n_drawobjs+1
#glDrawElements(self._glelement, self._n_vpo *(self._n_vpo-1)*self._n_drawobjs, GL_UNSIGNED_INT, None)
glDrawElements(self._glelement, len(
self._vertexvbo), GL_UNSIGNED_INT, None)
# glDisableClientState(GL_VERTEX_ARRAY)
# glDisableClientState(GL_COLOR_ARRAY)
self._vertexvbo.unbind()
self._indexvbo.unbind()
self._colorvbo.unbind()
class SelectToolMixin(BaseTool):
"""
Mixin for Selection tools for OGL canvas.
"""
def _init_select(self, is_show_selected=False, detectwidth=0.1, detectpix=5):
"""
Define selection specific attributes.
"""
self.detectpix = detectpix
self.de
没有合适的资源?快使用搜索试试~ 我知道了~
sumo-gui的windows版及教程
共1916个文件
html:634个
py:410个
png:331个
需积分: 50 33 下载量 65 浏览量
2018-07-24
11:28:00
上传
评论 2
收藏 41.72MB RAR 举报
温馨提示
从sumo官网下载安装包速度较慢且不稳定,而且提供的是英文教程,我对教程中基本的用法进行了总结归纳,并且提供了相关软件文件夹,sumo-gui不需要安装。需要添加SUMO_HOME环境变量。
资源推荐
资源详情
资源评论
收起资源包目录
sumo-gui的windows版及教程 (1916个子文件)
100px- 4KB
149px- 11KB
150px- 29KB
170px- 7KB
190px- 52KB
196px- 31KB
200px- 3KB
210px- 18KB
253px- 53KB
258px- 13KB
267px- 30KB
282px- 10KB
285px- 16KB
286px- 17KB
300px- 64KB
320px- 19KB
336px- 17KB
350px- 35KB
400px- 104KB
420px- 12KB
448px- 14KB
450px- 38KB
500px- 33KB
50px- 4KB
550px- 46KB
600px- 125KB
760px- 225KB
800px- 213KB
Makefile.am 4KB
start-command-line.bat 799B
flowrouter.bat 117B
traceExporter.bat 98B
dua-iterate.bat 89B
COPYING 14KB
stylesheet.css 13KB
sumo.css 8KB
style.css 2KB
PKW_G_EU4.csv 2KB
PKW_D_EU4.csv 2KB
PC_G_EU4.csv 2KB
PC_D_EU4.csv 2KB
PKW_D_EU4.dec.csv 445B
PKW_G_EU4.dec.csv 444B
PC_G_EU4_FC.csv 284B
PC_D_EU4_FC.csv 283B
PKW_G_EU4_FC.csv 252B
PKW_D_EU4_FC.csv 251B
dfrouter.dfrocfg 757B
gdal201.dll 16.05MB
spatialite.dll 11.06MB
libmysql.dll 3.88MB
FOXDLL-1.6.dll 2.7MB
xerces-c_3_1.dll 2.37MB
libeay32.dll 1.5MB
libxml2.dll 1.25MB
geos.dll 1.24MB
msvcr120.dll 941KB
iconv.dll 893KB
sqlite3.dll 877KB
libtiff.dll 846KB
msvcp120.dll 645KB
proj.dll 352KB
ssleay32.dll 334KB
libcurl.dll 317KB
geos_c.dll 272KB
libpng16.dll 256KB
openjp2.dll 177KB
libpq.dll 147KB
expat.dll 134KB
zlib1.dll 69KB
freexl.dll 63KB
flows2routes_200s_interval.duarcfg 513B
flows2routes_100s_interval.duarcfg 513B
flows2routes_100s_interval_ext.duarcfg 513B
flows2routes.duarcfg 513B
trips2routes.duarcfg 513B
netedit.exe 5.48MB
sumo-gui.exe 5MB
sumo.exe 3.21MB
netconvert.exe 2.46MB
netgenerate.exe 1.36MB
duarouter.exe 1.13MB
marouter.exe 1020KB
jtrrouter.exe 990KB
dfrouter.exe 812KB
activitygen.exe 738KB
polyconvert.exe 640KB
emissionsDrivingCycle.exe 550KB
od2trips.exe 495KB
emissionsMap.exe 442KB
TraciTestClient.exe 230KB
Docker-sumo-demo1.gif 853KB
Background_example.gif 260KB
Tapas_0_0_2_shapes2.gif 134KB
Tapas_0_0_2_shapes1.gif 126KB
Trafficmodeller.gif 100KB
Scr_koeln_fastlane.gif 93KB
Tapas_0_0_2_shapes3.gif 75KB
Trans.gif 48KB
Scr_ernst-ruska.gif 28KB
共 1916 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
LeiZhen
- 粉丝: 20
- 资源: 8
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- base.apk
- Vue 结合 D3.js 进行数据可视化开发的练手案例.zip
- 语音模块使用说明_jr6001调试工具.html
- 毕业设计-reat18货物运输后台管理系统
- Qt tcp通信(exe)
- tensorflow-gpu-2.7.3-cp39-cp39-manylinux2010-x86-64.whl
- tensorflow-2.8.0-cp37-cp37m-manylinux2010-x86-64.whl
- tensorflow-2.7.4-cp39-cp39-manylinux2010-x86-64.whl
- HTML后台管理系统源49套合集 H5模板源码下载 总有一款适合你 静态页面
- DDColor-PDF文献
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功