Visual Basic application for visualization of a network of planar connections between 10 colleges in Virginia

For this assignment, you are going to develop an application for visualization of a network of planar connections between 10 colleges in Virginia. The application uses a database of connections between colleges and the distances in between. By querying this database, the application creates a list of colleges as nodes and a list of connections between these colleges. The user can select a college from a list box or a radio button on the map to display the incoming and outgoing arcs listed in a tree view object. The list box is synchronized with radio buttons that represent each college on the map (the synchronization code is provided). A screenshot of the application is provided at the bottom. Follow the instructions below to complete the assignment:

  1. Download the file Homework3.zip in your BIT 3444 folder and extract it. Note that the frmColleges.vb file in the project has some partial code that should not be deleted; develop your code above the existing code.
  2. Create Class Node with properties ID as String, ArcsIn as new list of Arc, and ArcsOut as new list of Arc. Create a default constructor, and a custom constructor that takes in a String parameter and sets the ID property.
  3. Crate Class Arc with properties ID as String, Tail as Node, Head As Node, and Distance as decimal. Create a default constructor, and a custom constructor with three parameters: (i) tail as Node, (ii) head as Node and (iii) distance as decimal. With these three parameters, the respective properties of Arc is set, and also the ID property is set as the concatenation of the tail ID and head ID with the string “-TO-“ in between.
  4. Create a new blank Access database in your Homework3 folder with the name “Network.accdb”. Locate the file Arcs.xlsx file in the same folder and import the table in the Excel file to your database with the name “Arcs”. Select the option “No primary key” during the import steps. Add the database to your project: click on Project > Add Existing Item, select Data Files filter to the right of File Name, and select Network.accdb. Check if it appears in Solution Explorer
  5. Create Class Database with myDataset property as a new DataSet, include the following:
    a) Create a default constructor.
    b) Include Function GetDataAdapter that takes in a SQL statement and returns an OleDbDataAdapter (see InClass W07B).
    c) Create Function GetNodes that returns a sorted list of String type keys and Node type values. In this function you should do the following: create a data adapter that fills your dataset with distinct college names form the Tail column of the Arcs table in your database, and name the resulting table “Nodes” in your dataset. Create a new sorted list of string type keys and Node type values. Then using a for-loop, get the college names from the resulting table (you can access the i-th row, for example, using myDataset.Tables(“Nodes”).Rows(i)(“Tail”)), create a new node with the college name as its ID, and add the name as key, and node as value to the sorted list. Finally return this sorted list of nodes from the function.
    d) Create Function GetArcs with one parameter as the node list as a sorted list of String type keys and Node type values. This function returns a sorted list of String type keys and Arc type values. In this function you should do the following: create a data adapter that fills your dataset with all of the information from the Arcs table in your database, and name the resulting table “Arcs” in your dataset. Create a new sorted list of String type keys and Arc type values. Then using a for-loop, get all information from the resulting table (you can access the i-th row, for example, using myDataset.Tables(“Arcs”).Rows(i)(“Tail”), and use “Head” or “Distance” in the last parentheses for the information in the other columns), get the tail and head nodes from your sorted list for nodes using their IDs, and create an arc with the tail and head node and the distance information. Add the arc to ArcsOut and ArcsIn lists of the tail and head nodes, respectively, and add the arc to the sorted list of arcs with its ID as key and the arc itself as the value. Finally return the sorted list of arcs from the function.
  6. In frmColleges.vb file in your project, you will see some partial code, which should not be deleted. Include the following above the existing code:
    a) Module level variables: a new variable for your database, a new sorted list for your nodes of String type keys and Node type values, a new sorted list for your arcs of String type keys and Arc type values.
    b) Create Sub UpdateTreeView that takes in a college name as a String parameter. First clear the Nodes property of the tree view object trvNetwork on your form. Then create a new instance of a TreeNode object with the text property as the input parameter college name, and add it to Nodes property of trvNetwork. Create another TreeNode with text “ArcsIn”, and add it to the Nodes property of the TreeNode with the college name you created previously; repeat with another TreeNode for “ArcsOut”. Get the node for the input college name from the sorted list of nodes. For each arc in ArcsIn list of this node, add a TreeNode to Nodes property of the “ArcsIn” TreeNode that you created above; repeat the same For each arc in ArcsOut list, again using a For-each loop. (See the screenshot for the structure of the tree view object).
    c) In the Load Even Handler, create your sorted list of nodes by calling GetNodes method of your database variable. Similarly, create your sorted list of arcs by calling GetArcs method of your database variable, using your node list as its input parameter. Populate the list box lstColleges with the college names from the keys of the sorted list of nodes. Select the first entry in lstColleges, and call UpdateTreeView with the Text property of lstColleges as input. Finally, call sub SyncColleges (which has already been developed at the bottom).
    d) Double-click on trvNetwork object to create the sub for handling the AfterSelect Event. In this sub, create a TreeNode variable to hold the SelectedNode property of trvNode (see InClass W07B). Depending the Text property of this TreeNode object or its Parent property (which is also a TreeNode), identify whether it is under the “ArcsIn” or “ArcsOut” lists. Note that the trvNetwork.Node(0).Text is the selected college. You can concatenate two college names (selected and head, or selected and tail college) with “-TO-“ in the middle to create an arc ID and retrieve the arc from your sorted list of arcs with this ID. Then you can display the distance of this arc in txtDistance.
    e) Double-click on lstColleges to create the sub for handling the SelectedIndexChanged Event. In this sub, call UpdateTreeView with the Text property of lstColleges, and then call SyncColleges.
    f) Write the code to close the form in the event handler for the close button.

When you are done, please save all of your work and close the project, zip the project folder, and name the zip file using the format <LastName>_HW3.zip if you are submitting by yourself, replacing <LastName> with your own lastname (e.g. Seref_HW3.zip). If you are submitting as a group of two students, then use the format <LastName1>_<LastName2>_HW3.zip (e.g. Seref_Skywalker_HW3.zip).If you are submitting as a group of two students, only one student should submit the assignment.

 

Need a custom answer at your budget?

This assignment has been answered 4 times in private sessions.

Or buy a ready solution below.

Buy ready solution

Solution previews

© 2024 Codify Tutor. All rights reserved