(directoryPath)
| 107 | |
| 108 | |
| 109 | def zipAllTimeSteps(directoryPath): |
| 110 | if os.path.isfile(directoryPath): |
| 111 | return |
| 112 | |
| 113 | class UrlCounterDict(dict): |
| 114 | Counter = 0 |
| 115 | |
| 116 | def GetUrlName(self, name): |
| 117 | if name not in self.keys(): |
| 118 | self[name] = str(objNameToUrls.Counter) |
| 119 | self.Counter = self.Counter + 1 |
| 120 | return self[name] |
| 121 | |
| 122 | def InitIndex(sourcePath, destObj): |
| 123 | with open(sourcePath, "r") as sourceFile: |
| 124 | sourceData = sourceFile.read() |
| 125 | sourceObj = json.loads(sourceData) |
| 126 | for key in sourceObj: |
| 127 | destObj[key] = sourceObj[key] |
| 128 | # remove vtkHttpDataSetReader information |
| 129 | for obj in destObj["scene"]: |
| 130 | obj.pop(obj["type"]) |
| 131 | obj.pop("type") |
| 132 | |
| 133 | def getUrlToNameDictionary(indexObj): |
| 134 | urls = {} |
| 135 | for obj in indexObj["scene"]: |
| 136 | urls[obj[obj["type"]]["url"]] = obj["name"] |
| 137 | return urls |
| 138 | |
| 139 | def addDirectoryToZip( |
| 140 | dirname, zipobj, storedData, rootIdx, timeStep, objNameToUrls |
| 141 | ): |
| 142 | # Update root index.json file from index.json of this timestep |
| 143 | with open(os.path.join(dirname, "index.json"), "r") as currentIdxFile: |
| 144 | currentIdx = json.loads(currentIdxFile.read()) |
| 145 | urlToName = getUrlToNameDictionary(currentIdx) |
| 146 | rootTimeStepSection = rootIdx["animation"]["timeSteps"][timeStep] |
| 147 | for key in currentIdx: |
| 148 | if key == "scene" or key == "version": |
| 149 | continue |
| 150 | rootTimeStepSection[key] = currentIdx[key] |
| 151 | for obj in currentIdx["scene"]: |
| 152 | objName = obj["name"] |
| 153 | rootTimeStepSection[objName] = {} |
| 154 | rootTimeStepSection[objName]["actor"] = obj["actor"] |
| 155 | rootTimeStepSection[objName]["actorRotation"] = obj["actorRotation"] |
| 156 | rootTimeStepSection[objName]["mapper"] = obj["mapper"] |
| 157 | rootTimeStepSection[objName]["property"] = obj["property"] |
| 158 | |
| 159 | # For every object in the current timestep |
| 160 | for folder in sorted(os.listdir(dirname)): |
| 161 | currentItem = os.path.join(dirname, folder) |
| 162 | if os.path.isdir(currentItem) is False: |
| 163 | continue |
| 164 | # Write all data array of the current timestep in the archive |
| 165 | for filename in os.listdir(os.path.join(currentItem, "data")): |
| 166 | fullpath = os.path.join(currentItem, "data", filename) |
nothing calls this directly
no test coverage detected