本文整理汇总了Golang中github.com/axel-freesp/sge/views/graph.ArchIf类的典型用法代码示例。如果您正苦于以下问题:Golang ArchIf类的具体用法?Golang ArchIf怎么用?Golang ArchIf使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArchIf类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Select2
func (v *mappingView) Select2(obj interface{}, id string) {
switch obj.(type) {
case bh.NodeIf:
p, ok := v.mapping.Mapped(id)
if !ok {
// todo: unmapped nodes
return
}
var a graph.ArchIf
a, ok = v.focusArchFromUserObject(p.Arch())
if !ok {
log.Printf("mappingView.Select error: arch %s not found\n", a.Name())
return
}
/*
pr := a.SelectProcess(p)
if pr == nil {
log.Printf("mappingView.Select error: process %v not found\n", p)
return
}
* */
for _, n := range v.nodes {
// TODO: filenames...
modified, _ := n.SelectNode(freesp.NodeIdFromString(n.Name(), ""),
freesp.NodeIdFromString(id, ""))
if modified {
v.repaintArch(a)
}
}
}
}
开发者ID:axel-freesp,项目名称:sge,代码行数:31,代码来源:mappingview.go
示例2: drawChannels
func (v *mappingView) drawChannels(context *cairo.Context, r image.Rectangle) {
for _, a := range v.arch {
for _, pr := range a.Processes() {
for _, c := range pr.UserObj().OutChannels() {
link := c.Link()
lpr := link.Process()
la := lpr.Arch()
if la.Name() != a.Name() {
var a2 graph.ArchIf
for _, a2 = range v.arch {
if a2.UserObj() == la {
break
}
}
p1 := a.ChannelPort(c)
p2 := a2.ChannelPort(link)
if p1 == nil || p2 == nil {
log.Printf("mappingView.drawChannels error: invalid nil port (%s - %s).\n", a.Name(), la.Name())
continue
}
r, g, b, _ := graph.ColorOption(graph.NormalLine)
context.SetLineWidth(2)
context.SetSourceRGB(r, g, b)
pos1 := p1.Position().Add(image.Point{5, 5})
pos2 := p2.Position().Add(image.Point{5, 5})
graph.DrawLine(context, pos1, pos2)
}
}
}
}
}
开发者ID:axel-freesp,项目名称:sge,代码行数:31,代码来源:mappingview.go
示例3: archDrawBox
func (v *mappingView) archDrawBox(a graph.ArchIf) image.Rectangle {
ret := a.BBox()
for _, aa := range v.arch {
if aa.IsLinked(a.Name()) {
ret = ret.Union(aa.BBox())
}
}
return ret
}
开发者ID:axel-freesp,项目名称:sge,代码行数:9,代码来源:mappingview.go
示例4: Select
func (v *mappingView) Select(obj interface{}) {
switch obj.(type) {
case pf.ArchIf:
arch := obj.(pf.ArchIf)
a, ok := v.focusArchFromUserObject(arch)
if ok {
v.selectArch(a)
}
case pf.ProcessIf:
pr := obj.(pf.ProcessIf)
a, ok := v.focusArchFromUserObject(pr.Arch())
if ok {
a.SelectProcess(pr)
v.repaintArch(a)
}
case pf.ChannelIf:
ch := obj.(pf.ChannelIf)
a, ok := v.focusArchFromUserObject(ch.Process().Arch())
if ok {
a.SelectChannel(ch)
v.repaintArch(a)
}
case mp.MappedElementIf:
melem := obj.(mp.MappedElementIf)
p, isMapped := melem.Process()
var pr graph.ProcessIf
var a graph.ArchIf
if !isMapped {
pr = v.unmapped
} else {
var ok bool
a, ok = v.focusArchFromUserObject(p.Arch())
if !ok {
log.Printf("mappingView.Select error: arch %s not found\n", a.Name())
return
}
pr = a.SelectProcess(p)
if pr == nil {
log.Printf("mappingView.Select error: process %v not found\n", p)
return
}
}
pr.(*graph.ProcessMapping).SelectNode(melem.NodeId(), melem.NodeId())
if isMapped {
v.repaintArch(a)
} else {
v.repaintUnmapped(v.unmapped)
}
default:
}
}
开发者ID:axel-freesp,项目名称:sge,代码行数:51,代码来源:mappingview.go
示例5: focusArchFromUserObject
func (v *mappingView) focusArchFromUserObject(obj pf.ArchIf) (ret graph.ArchIf, ok bool) {
var a graph.ArchIf
for _, a = range v.arch {
if obj.Name() == a.UserObj().Name() {
ret = a
ok = true
} else {
if a.Deselect() {
v.repaintArch(a)
}
}
}
return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:14,代码来源:mappingview.go
示例6: selectArch
func (v *platformView) selectArch(toSelect graph.ArchIf) {
var a graph.ArchIf
for _, a = range v.arch {
if a.Name() == toSelect.Name() {
if !a.Select() {
v.repaintArch(a)
}
}
}
}
开发者ID:axel-freesp,项目名称:sge,代码行数:10,代码来源:platformview.go
示例7: selectArch
func (v *mappingView) selectArch(toSelect graph.ArchIf) {
var a graph.ArchIf
for _, a = range v.arch {
if a.Name() == toSelect.Name() {
if a.Select() {
v.repaintArch(a)
}
return
}
}
}
开发者ID:axel-freesp,项目名称:sge,代码行数:11,代码来源:mappingview.go
注:本文中的github.com/axel-freesp/sge/views/graph.ArchIf类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论