Profile Picture

Trouble with displaying shapes in Diagram after import

Posted By Steven Simonton 12 Years Ago
Author
Message
Steven Simonton
Posted 12 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 5 Years Ago
Posts: 4, Visits: 11
I am using the NGraphDataSourceImporter to import shapes from a custom Web Service, both Vertex and Edges.

During the import within the OnVertexImported and OnEdgeImported events I am moving the imported shapes to layers that have been added to the Document and removing it from the ActiveLayer.

Protected Friend Sub OnVertexImported(ByVal importer As NDataSourceImporter, ByVal shape As NShape, ByVal dataRecord As INDataRecord)
Dim strFeatureDefName As String
Dim objdataRecord As INDataRecord
Dim objTravelShapesFactory As New NTravelShapesFactory()
Dim objBasicShapesFactory As New NBasicShapesFactory()
Dim objNetworkShapesFactory As New NSimpleNetworkShapesFactory
Dim objCursorType As CursorType = CursorType.Default
Dim objDiagramDocument As NDrawingDocument
Dim objLayersCollection As NLayerCollection
Dim strLayerName As String = ""
Dim objGroup As NGroup = New NGroup()
Dim objLayer As NLayer
Dim objNewShape As NShape = Nothing

Try

Dim group As New NGroup()
Dim objSiteConfiguration As New SiteConfiguration

objDiagramDocument = importer.Document

objLayersCollection = objDiagramDocument.Layers

objdataRecord = dataRecord

strFeatureDefName = dataRecord.GetColumnValue("FEATURE_DEF_NAME")

Dim strEntityEname As String = dataRecord.GetColumnValue("ENAME")

shape.Style.FillStyle = New NColorFillStyle(objSiteConfiguration.FeatureColor(strFeatureDefName))

Select Case strFeatureDefName
Case "TERMINAL_PORT"
strLayerName = mstr_layerFiberTerminalInPorts
Case ("SPLITTER_IN_PORT")
strLayerName = mstr_layerInSplitterPorts
Case "SPLITTER_OUT_PORT"
strLayerName = mstr_layerOutSplitterPorts
Case "CO_PORT"
strLayerName = mstr_layerCentralOfficePorts
Case "FIBER_TERMINAL"
strLayerName = mstr_layerFiberTerminals
Case "FIBER_SERVICE_POINT"
strLayerName = mstr_layerFiberNid
Case "CUSTOMER_HOUSE"
strLayerName = ""
Case "FIBER_SPLITTER"
strLayerName = mstr_layerSplitter
Case "CO"
strLayerName = mstr_layerCentralOffice
End Select

shape.Name = strEntityEname

objLayer = objDiagramDocument.Layers.GetChildByName(strLayerName)

objNewShape = shape
objDiagramDocument.ActiveLayer.RemoveChild(shape)

objLayer.AddChild(objNewShape)

Dim text As Object = dataRecord.GetColumnValue("ID")
If text Is Nothing Then
shape.Text = "Title not specified"
Else
shape.Text = text.ToString()
End If

shape.SizeToText(New NMarginsF(10))

Dim strURL As String = Me.RequestPath & EntityDetailURL & "?entityEname=" & strEntityEname

' make the URL a tooltip of the shape
Dim url As String = String.Format(strURL, HttpUtility.UrlEncode(strURL))

If strEntityEname Is Nothing Or strEntityEname.Length = 0 Then
shape.Style.InteractivityStyle = New NInteractivityStyle("URL not specified")
Else
Dim objUrlLink As NUrlLinkAttribute = New NUrlLinkAttribute(url, False)

objCursorType = CursorType.Hand
shape.Style.InteractivityStyle = New NInteractivityStyle(True, strEntityEname, shape.Text, objCursorType)
shape.Style.InteractivityStyle.InteractivityAttributes.Add(objUrlLink)

End If

Catch ex As Exception
Throw ex
End Try

End Sub

Protected Friend Sub OnEdgeImported(ByVal dataSourceImporter As Nevron.Diagram.DataImport.NDataSourceImporter, ByVal shape As Nevron.Diagram.NShape, ByVal record As Nevron.Diagram.DataImport.INDataRecord)

Dim objLinkIdentifier As Object = record.GetColumnValue("LINK_IDENTIFER")
Dim objEntityEname As Object = record.GetColumnValue("LINK_ENAME")
Dim strEntityEname As String = ""
Dim strLabel As String = ""
Dim strURL As String = ""
Dim objDiagramDocument As NDrawingDocument
Dim objCursorType As CursorType = CursorType.Default
Dim objLayer As NLayer
Dim objNewShape As NShape

Try
Dim objSiteConfiguration As New SiteConfiguration

If objLinkIdentifier Is Nothing Or objLinkIdentifier.ToString.Length = 0 Then
strLabel = "Interal Link"
strLabel = ""
Else
strLabel = objLinkIdentifier.ToString
End If

If objEntityEname Is Nothing Or objEntityEname.ToString.Length = 0 Then
strEntityEname = ""
strURL = ""
Else

strEntityEname = objEntityEname.ToString
'strURL = String.Format(EntityDetailURL & "?entityEname=" & strEntityEname, HttpUtility.UrlEncode(EntityDetailURL & "?entityEname=" & strEntityEname))
strURL = Me.RequestPath & EntityDetailURL & "?entityEname=" & strEntityEname
End If

If strLabel.Length = 0 Then
objCursorType = CursorType.Default
Else
objCursorType = CursorType.Hand
End If
shape.Text = strLabel

If objEntityEname Is Nothing Or objEntityEname.ToString.Length = 0 Then
shape.Style.StrokeStyle = New NStrokeStyle(objSiteConfiguration.ConnectionColor("LogicalConnectionColor"))
shape.Style.StrokeStyle.Pattern = objSiteConfiguration.ConnectionPattern("LogicalConnectionPattern")
shape.Style.StrokeStyle.Factor = 2
shape.Style.StrokeStyle.Width = New NLength(objSiteConfiguration.ConnectionWeight("LogicalConnectionWeight"))

Else
shape.Style.StrokeStyle = New NStrokeStyle(objSiteConfiguration.ConnectionColor("PhysicalConnectionColor"))
shape.Style.StrokeStyle.Pattern = objSiteConfiguration.ConnectionPattern("PhysicalConnectionPattern")
shape.Style.StrokeStyle.Factor = 1
shape.Style.StrokeStyle.Width = New NLength(objSiteConfiguration.ConnectionWeight("PhysicalConnectionWeight"))

End If

Dim objUrlLink As NUrlLinkAttribute = New NUrlLinkAttribute(strURL, False)
objUrlLink.OpenInNewWindow = True

shape.Style.InteractivityStyle = New NInteractivityStyle(True, strEntityEname, strLabel, objCursorType)
shape.Style.InteractivityStyle.InteractivityAttributes.Add(objUrlLink)

objDiagramDocument = dataSourceImporter.Document
objLayer = objDiagramDocument.Layers.GetChildByName(mstr_layerConnectors)

objNewShape = shape
objDiagramDocument.ActiveLayer.RemoveChild(shape)

objLayer.AddChild(objNewShape)

shape.SizeToText(New NMarginsF(20))

Catch ex As Exception
Throw ex
End Try

End Sub

However when the Diagram is displayed within the WebForm it is blank. All of the shapes are within the respective layers and all of the layers visible properties are set to true.



Threaded View



Similar Topics


Reading This Topic