com.py :  » Business-Application » ThanCad » thancad-0.0.9 » p_gmhk » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Business Application » ThanCad 
ThanCad » thancad 0.0.9 » p_gmhk » com.py
# -*- coding: iso-8859-7 -*-

import p_ggen

class ThanMemoryFile:
    """A class that simulates a Fortran direct file in memory.
    
    The total number of "lines" of the fortran direct file is: n=len(self.record)
    The first "line" (line=1)                of the fortran direct file is self.record[0]
    The last  "line" (line=len(self.record)) of the fortran direct file is self.record[n-1]
    """
    
    def __init__(self):
        "Set empty storage."
        self.record = []
  self.irec = 0                    # Next record to read
  
    def writerec(self, rec=None, data=()):
        "Store the data in the rec position in the list."
  if rec == None or rec == len(self.record):
      self.record.append(data)
      self.irec = len(self.record) # Next record to read
  elif rec < len(self.record):
      self.record[rec] = data
      self.irec = rec + 1          # Next record to read
  else:
      for i in xrange(len(self.record), rec-1):
          self.record.append(())
      self.record.append(data)
      self.irec = len(self.record) # Next record to read

    def readrec(self, rec=None):
        "Retrieves the data in the rec position."
  if rec == None: rec = self.irec
  self.irec = rec + 1              # Next record to read
  return self.record[rec]

    def rewind(self):
        "Set the first record the next record to read."
  self.irec = 0

    def eof(self):
        "Returns true if we reached the end of file."
  return self.irec >= len(self.record)

    def clear(self):
        "Clears all the data."
        del self.record[:]
  self.irec = 0                    # Next record to read
  


if True:

#-----dagog:   
#-----xagog:        

    
#-----CONSTANTS
      MYEE  = 8             # Maximum number of ground/grade lines
      MLEPT = 1             # Number of kinds of drawing details
      HS   = 0.16           # Drawn character/number height, in cm
      DYGR = 1.2            # Width documentation zones
      UM1  = 1.0            # Up paper margin, in cm
      DM1  = 0.5            # Down paper margin, in cm
      ANOIGM = 11           # Maximum span of a bridge
      MAXP=5000; MAXK=100; MAXC=5
      GAP=0.125             #                           
      HG=0.25               #   
      TextFEnd=2.0; PI=3.14159265358979323; TAS=3.0
      ROADWIDTH=0.2         #                                    
      TextW=8.0 
      TEXTFBEG=2.0
      asfaltos=0.3
#-----end of CONSTANTS
      
      XAK=XNUMP=0.0
      YEDMAX=XKLI=XSHM1=XSHM2=XSHM2P=XSTK=XKMHD= 0.0 # dagog, xagog,



      
      uTed = ThanMemoryFile() # Temporary file ground lines 
      uTer = ThanMemoryFile() # Temporary file grade lines 
      uTef = ThanMemoryFile() # Temporary file drawing details 
      uTeo = ThanMemoryFile() # Temporary file horizontal curves

      iseira = []           # Sequence of all the grade lines
      icod1  = []           # Original type of ground/grade lines
      icod   = []           # Working type of ground/grade lines
      ititl  = []           # short titles of ground/grade lines
      diak1  = []           # Definition of dashed line for ground/grade lines - for old pen plotters - not used any more
      ied    = []           # indexes of ground lines in list yee
      yee    = []           # Heights of all ground/grade lines of current station
      yeep   = []           # Heights of all ground/grade lines of previous station
      laygram= []           # Name of layer of ground/grade lines
      ned    = 0            # Number of ground lines == len(ied)
      nyee   = 0            # Number of ground/grade lines == len(yee)
      ner    = 0            # Number of grade lines == nyee - ned
      ipenl  = 1            # Pen to use for thin lines - for old pen plotter - not used any more
      ipenx  = 2            # Pen to use for thick lines - for old pen plotter - not used any more
      
      xther1 = []           # Station       of previous grade line node
      yer1   = []           # Height        of previous grade line node
      r2     = []           # Radius/height of previous grade line node
      xther2 = []           # Station       of current  grade line node
      yer2   = []           # Height        of current  grade line node
      r2     = []           # Radius/height of current  grade line node
      xther2 = []           # Station       of next     grade line node
      yer2   = []           # Height        of next     grade line node
      r2     = []           # Radius/height of next     grade line node
      ai1    = []           # Slope between previous and current grade line node
      ai2    = []           # Slope between current  and next    grade line node
      t      = []           # Length of tangential to the vertical curve of each grade line node
      oxienl = []           # If false, the correspodent grade line must proceed to the next node
      
      xthed  = 0.0          # Station of current ground point
      xthedp = 0.0          # Station of previous ground point
      onp    = ""           # Name of current ground point
      xthar  = 0.0          # Station of previous ground point
      yor    = 0.0          # Height of current horizon
      akat   = 0.0          # Code of current ground point to control (water)fall
      xthmod = 0.0          # Assist in keeping only certain digits when drawing stations
      ndxth  = 0.0          # How many decimal digits to keep when drawing stations
      mhk    = ""           # Name of current profile
      
      kedaf  = 0            # Primary ground line (this is used for excavation computation)
      keryth = 0            # Primary grade line (this is used for excavation computation)
      
      aklx = 1.0            # Scale in the x (station) axis
      akly = 1.0            # scale in the y (height) axis
      pklx = 100/aklx       # x scale factor
      pkly = 100/akly       # y scale factor
      
      oxiery = True         # If true the grade lines are not drawn/computed
      oxikam = True         # If true the horizontal curves are not drawn/computed
      odopoi = True         # If true, the section is highway(road). Else it is sewage,irrigation,
      oxikak = True         # if True, the vertical slopes are not drawn
      sxetit = False        # If False, the title is drawn only on the first section (multiple sections are possible)
      drawguidlines = True  # If True, guide lines are drawn, where the paper should be cut
      drawtitle = False     # If True, a general drawing title is made
      drawlep = False       # If True, drawing details will be made
      sxedFreat = False     # If true, freatia will be drawn instaed of vertical lines 

      plaxar = 29.0         # The paper width that the plotter can plot, in cm
      plxm = plaxar-8*HS-2.5# Paper width taken by the documentation (heights,stations etc.)
      platit = 5.5          # Paper width taken by documentation zones == 5.5+nyee*DYGR (nyee minus the dependent grade lines)
      um     = UM1          # Up paper margin, in cm. If drawguidlines==False then we set um=0.0
      dm     = DM1          # Down paper margin, in cm. If drawguidlines==False then we set um=0.0
      perype = 1.5          # Margin between documenation and actual drawing
      titper = platit+perype# Paper width take by doumentation zoned and margin
      
      sxedfreat = False     # If False, freatia are not drawn (along every vertical line)
      pfr       = 0.0       # Freatio's width
      hfr       = 0.0       # Freation's height
      
      linlep = [0] * MLEPT  # Last line of each draing detail
      lasted = 0            # Last line in the temporary ground file
      laster = []           # Last line of each grade line in the temporary grade file
      linery = []           # Currebt line of each grade line in the temporary grade file
      telmhk = False        # If True, the current section is the last sectiuon in the data file
      
      dxom   = 0.0          # Excavation depth or overfill height
      prt    = p_ggen.prg   # Print function
      frw    = {}           # Opened file objects


#-----------------------------------------------------------------------c
# edafos(i, 1..2)   x  y          c
#                                             c
# xthb       ..                       c
# pl1, pl2                                    c
# ianoig                                        c
# sitem           character*4                     c
# sitemBig        character*20                    c
# mikos                                c
# gxf          x                                    c
# kil                                                c
# ery                                              c
# edaf                                                   c
# katar      ..                                 c
# katarcount                                           c
# MAXP                                            c
# MAXK                                         c
# MAXC                                     c
# TextW, TextFBeg, TextFEnd    : ,   , c
#                                                     c
# kl1, kl2                                                 c
# tas                                            c
# bridgealt                   c
# paxos                                         c
# pkol                                                     c
# pthem                                                   c
# ythem                                                     c
# freeminheight    ()                          c
# infos1       .false.  comments   layer 'SXOLIA'         c
#              .true.   comments   layer 'SXOLIA1'        c
# infosOr      .false.  comments               c
#              .true.   comments            c
#-----------------------------------------------------------------------c
      edafos = [[0.0,0.0]]*ANOIGM
      xthb= pl1= pl2= paxos = 0.0
      mikos= gxf= paxosd=0.0
      kil=[]; ery=[]; edaf=[]
      katar = []
      paper=kl1=kl2=0.0
      ythb= pkol= pthem= ythem= bridgealt= freeminheight=0.0
      lepcount= ianoig= katarcount=0
      infos1= infosOr=True
      sitemBig= sitem=""
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.