Exemple #1
0
    def traverse(self, iter):
        it = AdjacencyIterator(iter)
        ## case of TVertex
        vertex = self.next_vertex
        if type(vertex) is TVertex:
            mate = vertex.get_mate(self.current_edge)
            return self.make_sketchy(find_matching_vertex(mate.id, it))
        ## case of NonTVertex
        winner = None
        for i, nat in enumerate(NATURES):
            if (nat & self.current_edge.nature):
                for ve in it:
                    if ve.id == self.current_edge.id:
                        continue
                    ve_nat = ve.nature
                    if (ve_nat & nat):
                        if nat != ve_nat and nature_in_preceding(ve_nat, i):
                            break

                        if winner is not None:
                            return self.make_sketchy(None)

                        winner = ve
                break
        return self.make_sketchy(winner)
    def traverse(self, iter):
        it = AdjacencyIterator(iter)
        ## case of TVertex
        vertex = self.next_vertex
        if type(vertex) is TVertex:
            mate = vertex.get_mate(self.current_edge)
            return self.make_sketchy(find_matching_vertex(mate.id, it))
        ## case of NonTVertex
        winner = None
        for i, nat in enumerate(NATURES):
            if (nat & self.current_edge.nature):
                for ve in it:
                    if ve.id == self.current_edge.id:
                        continue
                    ve_nat = ve.nature
                    if (ve_nat & nat):
                        if nat != ve_nat and nature_in_preceding(ve_nat, i):
                            break

                        if winner is not None:
                            return self.make_sketchy(None)

                        winner = ve
                break
        return self.make_sketchy(winner)
    def traverse(self, iter):
        winner = None
        winnerOrientation = False
        it = AdjacencyIterator(iter)
        # case of TVertex
        vertex = self.next_vertex
        if type(vertex) is TVertex:
            mate = vertex.get_mate(self.current_edge)
            winner = find_matching_vertex(mate.id, it)
            winnerOrientation = not it.is_incoming if not it.is_end else False
        # case of NonTVertex
        else:
            for nat in NATURES:
                if (self.current_edge.nature & nat):
                    for ve in it:
                        if (ve.nature & nat):
                            if winner is not None:
                                return None
                            winner = ve
                            winnerOrientation = not it.is_incoming
                    break

        # check timestamp to see if this edge was part of the selection
        if winner is not None and winner.time_stamp != self.timestamp:
            # if the edge wasn't part of the selection, let's see
            # whether it's short enough (with respect to self.percent)
            # to be included.
            if self._length == 0.0:
                self._length = get_chain_length(winner, winnerOrientation)

            # check if the gap can be bridged
            connexl = 0.0
            _cit = pyChainSilhouetteGenericIterator(False, False)
            _cit.begin = winner
            _cit.current_edge = winner
            _cit.orientation = winnerOrientation
            _cit.init()

            while (not _cit.is_end
                   ) and _cit.object.time_stamp != self.timestamp:
                connexl += _cit.object.length_2d
                _cit.increment()
                if _cit.is_begin:
                    break

            if connexl > self._percent * self._length:
                return None

        return winner
    def traverse(self, iter):
        winner = None
        winnerOrientation = False
        it = AdjacencyIterator(iter)
        ## case of TVertex
        vertex = self.next_vertex
        if type(vertex) is TVertex:
            mate = vertex.get_mate(self.current_edge)
            winner = find_matching_vertex(mate.id, it)
            winnerOrientation = not it.is_incoming if not it.is_end else False
        ## case of NonTVertex
        else:
            for nat in NATURES:
                if (self.current_edge.nature & nat):
                    for ve in it:
                        if (ve.nature & nat):
                            if winner is not None:
                                return None
                            winner = ve
                            winnerOrientation = not it.is_incoming
                    break

        # check timestamp to see if this edge was part of the selection
        if winner is not None and winner.time_stamp != self.timestamp:
            # if the edge wasn't part of the selection, let's see
            # whether it's short enough (with respect to self.percent)
            # to be included.
            if self._length == 0.0:
                self._length = get_chain_length(winner, winnerOrientation)

            # check if the gap can be bridged
            connexl = 0.0
            _cit = pyChainSilhouetteGenericIterator(False, False)
            _cit.begin = winner
            _cit.current_edge = winner
            _cit.orientation = winnerOrientation
            _cit.init()

            while (not _cit.is_end) and _cit.object.time_stamp != self.timestamp:
                connexl += _cit.object.length_2d
                _cit.increment()
                if _cit.is_begin:
                    break

            if connexl > self._percent * self._length:
                return None

        return winner
    def traverse(self, iter):
        winner = None
        winnerOrientation = False
        it = AdjacencyIterator(iter)
        # case of TVertex
        vertex = self.next_vertex
        if type(vertex) is TVertex:
            mate = vertex.get_mate(self.current_edge)
            winner = find_matching_vertex(mate.id, it)
            winnerOrientation = not it.is_incoming if not it.is_end else False
        # case of NonTVertex
        else:
            for nat in NATURES:
                if (self.current_edge.nature & nat):
                    for ve in it:
                        if (ve.nature & nat):
                            if winner is not None:
                                return None
                            winner = ve
                            winnerOrientation = not it.is_incoming
                    break

        if winner is not None and winner.time_stamp != CF.get_time_stamp():

            if self._length == 0.0:
                self._length = get_chain_length(winner, winnerOrientation)

            connexl = 0.0
            _cit = pyChainSilhouetteGenericIterator(False, False)
            _cit.begin = winner
            _cit.current_edge = winner
            _cit.orientation = winnerOrientation
            _cit.init()
            while (not _cit.is_end
                   ) and _cit.object.time_stamp != CF.get_time_stamp():
                connexl += _cit.object.length_2d
                _cit.increment()
                if _cit.is_begin:
                    break

            if (connexl > self._percent * self._length) or (connexl >
                                                            self._absLength):
                return None
        return winner
    def traverse(self, iter):
        winner = None
        winnerOrientation = False
        it = AdjacencyIterator(iter)
        ## case of TVertex
        vertex = self.next_vertex
        if type(vertex) is TVertex:
            mate = vertex.get_mate(self.current_edge)
            winner = find_matching_vertex(mate.id, it)
            winnerOrientation = not it.is_incoming if not it.is_end else False
        ## case of NonTVertex
        else:
            for nat in NATURES:
                if (self.current_edge.nature & nat):
                    for ve in it:
                        if (ve.nature & nat):
                            if winner is not None:
                                return None
                            winner = ve
                            winnerOrientation = not it.is_incoming
                    break

        if winner is not None and winner.time_stamp != CF.get_time_stamp():

                if self._length == 0.0:
                    self._length = get_chain_length(winner, winnerOrientation)

                connexl = 0.0
                _cit = pyChainSilhouetteGenericIterator(False, False)
                _cit.begin = winner
                _cit.current_edge = winner
                _cit.orientation = winnerOrientation
                _cit.init()
                while (not _cit.is_end) and _cit.object.time_stamp != CF.get_time_stamp():
                    connexl += _cit.object.length_2d
                    _cit.increment()
                    if _cit.is_begin:
                        break

                if (connexl > self._percent * self._length) or (connexl > self._absLength):
                    return None
        return winner
 def traverse(self, iter):
     it = AdjacencyIterator(iter)
     ## case of TVertex
     vertex = self.next_vertex
     if type(vertex) is TVertex:
         mate = vertex.get_mate(self.current_edge)
         return find_matching_vertex(mate.id, it)
     ## case of NonTVertex
     winner = None
     for i, nat in enumerate(NATURES):
         if (nat & self.current_edge.nature):
             for ve in it:
                 ve_nat = ve.nature
                 if (ve_nat & nat):
                     # search for matches in previous natures. if match -> break
                     if nat != ve_nat and nature_in_preceding(ve_nat, index=i):
                         break
                     # a second match must be an error
                     if winner is not None:
                         return None
                     # assign winner
                     winner = ve
             return winner
Exemple #8
0
 def traverse(self, iter):
     it = AdjacencyIterator(iter)
     # case of TVertex
     vertex = self.next_vertex
     if type(vertex) is TVertex:
         mate = vertex.get_mate(self.current_edge)
         return find_matching_vertex(mate.id, it)
     # case of NonTVertex
     winner = None
     for i, nat in enumerate(NATURES):
         if (nat & self.current_edge.nature):
             for ve in it:
                 ve_nat = ve.nature
                 if (ve_nat & nat):
                     # search for matches in previous natures. if match -> break
                     if nat != ve_nat and nature_in_preceding(ve_nat, index=i):
                         break
                     # a second match must be an error
                     if winner is not None:
                         return None
                     # assign winner
                     winner = ve
             return winner